<?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');
?>
I also asked about this future, to hide all links for users that are not logged in.
I have a download section, and I’d love to hide the links for visitors, making it visible for logged in users only.
hey kawauso, thanks for that code i will try it!
i was thinking to cloak almost all links inside a post or thread.
mostly links to download sites like megaupload or rapidshare, etc. but also links to anything inside a post.
the code from kawauso is exactly what i’m talking about.
cya and thanks!