Recent Topics

1 Jan 18, 2009 14:46    

My b2evolution Version: 2.x

Hi! A friend of my was thinking to do a link directory for the sites of his hobby. And I think its possible to do so with the b2evo. Yet, I dont know how could I match the links up to the db, in order to not repeat links inserted in the db... is that possible??? There is anything hidden feature to do so? Or should I need to code lots and lots of line of code in order to achieve it? (frankly, I would preffer to not code many lines, as its for a project that does not pay me a dime, so if there is any easy solution to this problem...) Thanks in advance!!! :D

PS: I mean, its possible to be done with wp... but I want to dev this with b2evo!!! :D

2 Jan 18, 2009 16:43

Probably the simplest / best method is to write a simple plugin that hooks into FilterItemContent() ( or similar ) and check that the url hasn't been used before, if it has set an error message and the post won't save.

¥

3 Jan 18, 2009 17:17

Hmm, seems like a lot of work... if I could manage to convince my friend to pay a few pennies (a guy with croks in his pockets... thats why Im doing this on first place!!!), would you do it? I cant promise any payment, but I can certainly demand that whatever is coded, it might be released into the community, coz a thing like this would be cool to have! :D (I even might be intrested, but not on a short term, due to my exams!!!)

If you cant, well, I know I might use wp... but I want to use b2evo!!! (but I dont certainly want to spend a week into something that it wont even be thanked)

PS: I mean, until now, I had no idea about the existence of "FilterItemContent()"... that and truth be told, if it were for an own project, I would put my hands into the code, but as its a typical "Id like to have it, is it hard to add it" type of situation... (people most of the times have no clue about how much time requires to code these "wonderful ideas"!!!)

4 Jan 18, 2009 18:38

Free typed ( and untested )

function FilterItemContents( $params )
{
  global $DB;
  $url = param( 'post_url', 'string' );
  $post_ID = param( 'post_ID', 'integer' );
  if( !empty( $url ) )
  {
    $sql = 'SELECT * FROM T_items__item WHERE post_url='.$DB->quote( $url ).' AND NOT( post_ID = '.$post_ID.' )';
    if( $DB->query( $sql ) )
    {
      $this->msg( $this->T_('You already have that link muppet' ), 'error' );
      return false;
    }
  }
}

¥

*edit*
minor bug fix, code updated ... still free typed and untested though ;)

5 Jan 18, 2009 19:37

Should I just test this as adding it as a normal b2evo plugin?

You already have that link muppet

Jejeje

6 Jan 18, 2009 19:37

woah, you already changed it while I was writing the post!: P (I gonna test it tonight)

7 Jan 18, 2009 19:45

yep, just slap that in .... urm, whatever that really slim plugins called ... 'skeleton.plugin.php'; .... if it works then go through the pita of renaming file/class/adding humorous notes and then do the write up, and the release on the plugins forum, and the plugins sub-domain ... and then yer gonna want a BOPIT login so you can release it there as well

Much less effort to see if it works first ;)

¥

8 Jan 18, 2009 19:51

It will take some time my dearest blonde bimbo, but Ill will test it asap I end with a damn wiki I need to install first (you know, payjobs goes first... and I hate this commission, as I suddenly find out at the last minute that the server to use WORKS WITH PHP4, NOT 5... grrrr) Anyway, thanks! :D

PS: Release any possible advice I need to know before I start testing this cute lines of code!!! :D

9 Jan 19, 2009 14:48

About the only advice is : if that doesn't work ( barring code errors ) then try this instead

    $sql = 'SELECT COUNT(*) FROM T_items__item WHERE post_url='.$DB->quote( $url ).' AND NOT( post_ID = '.$post_ID.' )';
    if( $DB->get_var( $sql ) ) 

Shouldn't take you longer than 5 minutes to knock up a test plugin though ;)

¥

10 Apr 25, 2009 18:33

¥åßßå,
Well, I did give it a try... but somehow, it seems not to be working... I must say that just cut & paste it (without any thinking, as I dont know the whole sys) I know, its kinda my fault not to test it more... but I do not know where to start in order to wrote code to do this link-affaire! :P Therefore... is it just me or there is something in the code you kindly wrote thats comploting against my intentions of using the b2evo as a checked linklist??? Any ideas???

11 Apr 28, 2009 19:35

Nudge me if I forget and I'll throw summat together ;)

¥


Form is loading...