Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Link Cloaking

<?php
/*
Plugin Name: Remove Links (conditional)
Description: Removes links for non-registered users. Based on <a href="http://ckon.wordpress.com/2007/07/12/bbpress-plugin-bb-tweaks/">bb tweaks</a>.
Plugin URI: https://bbpress.org/forums/topic/hide-links
Version: 0.01
*/

function bb_strip_links( $text ) {
global $topic;

$forums = array(
1,
2,
3,
);

if ( !in_array( $topic->forum_id, $forums ) )
return $text;

if ( !bb_current_user_can( 'write_post' ) )
$text = preg_replace('|<a (.+?)>(.+?)</a>|i', __('(Login or register to download)'), $text);

return $text;

}

add_filter('post_text', 'bb_strip_links');

?>

Skip to toolbar