Email
Share

We Rock Your Web Forum » Software » Web Applications

bbPress Remove Autolinking from Posts?

(4 posts)
  1. miraculix

    member
    Joined: Aug '09
    Posts: 27

    I see that you're using bbPress for this forum - very cool. And I've also noticed that, like the popular Webmaster World and other forums, you've been able to remove the ability for hyperlinks to automatically be created.

    I realize that Wordpress and bbPress automatically add "nofollow" to links created by users, but to me this is weak spam control considering at the time only Google adheres to the nofollow spec.

    So - would you mind divulging how on earth you hacked bbpress to remove the autolinking functionality? I've searched for hours and can't seem to find any info on this - no plugins, no forum posts, in fact, no one seems remotely interested in this capability. But obviously I'm not the only one?

    Posted 2 years ago #

  2. Posted 2 years ago
  3. cwd

    senior admin
    Joined: Jul '09
    Posts: 225

    Hi Miraculix,

    Great question. We did in fact have to hack bbPress to get this functionality. I should point out that we don't advocate hacking core code, as it will be overwritten when you update to the next release of bbPress. So make sure to make a note of any changes and port them over. We're hoping there will soon be a plugin that offers this functionality.

    Here we go - there are three files you'll need to edit and comment lines out in (note, this example assumes you're using bbpress v1.0.1 - line #'s and code may change in subsequent releases):

    bbpress/bb-includes/defaults.bb-filters.php
    line #76:
    //add_filter('post_text', 'make_clickable');

    bbpress/bb-includes/functions.bb-template.php
    line #2348:
    //$val = make_clickable( $val );

    You'll notice that we're simply uncommenting the lines that call the make_clickable function, which you'll find in the file bbress/bb-includes/backpress/functions.formatting.php

    Voila - links in your bbPress posts now won't automatically be linked (made clickable). To return to the previous functionality, simply restore the old files or uncomment the lines above.

    Posted 2 years ago #
  4. miraculix

    member
    Joined: Aug '09
    Posts: 27

    Very cool - thanks for the tip! How about the bbCode buttons above and the allowed markup below - any way to remove the anchor and URL capabilities?

    Posted 2 years ago #
  5. cwd

    senior admin
    Joined: Jul '09
    Posts: 225

    Yes, you'll need to edit and comment out the following files/ parts of code:

    bbpress/my-plugins/bbcode-lite/BBcode-lite.php (v1.0.3)
    line #26:
    //$bbcode_lite['complex']['url'] = array('a','href'); if (isset($tags['img'])) {$bbcode_lite['complex']['img'] = array('img','src');}
    line #27:
    $bbcode_lite['wrap'] = ... [i]/*'url' => array('a','href'),*/ ...
    lines #45 - 48:
    /*foreach($bbcode_lite['complex'] as $bbcode=>$html){
    if($bbcode!='url') {$text = preg_replace('/\['.$bbcode.'\](.+?)\[\/'.$bbcode.'\]/is','<'.$html[0].' '.$html[1].'="$1">',$text);}
    else {$text = preg_replace('/\['.$bbcode.'\](.+?)\[\/'.$bbcode.'\]/is','<'.$html[0].' '.$html[1].'="$1">$1</'.$html[0].'>',$text);}
    }*/

    And delete or comment out the following line:
    bbpress/my-plugins/bbcode-buttons/BBcode-buttons.php (v0.0.9)
    line #27:
    BBcodeButtons.push(new BBcodeButton('ed_link','URL','','[/url]','a','text-decoration:underline;','make a link'));

    Voila - that should do the trick.

    Posted 2 years ago #

RSS feed for this topic

Reply

(required)

Allowed markup: BBcode blockquote code em strong ul ol li font strike center u hr.
You can also put code in between backtick ( ` ) characters.