Forums

Join
bbPress Support ForumsPluginsLink Cloaking

Info

Tags

Link Cloaking

  1. heyy

    there's a way to hide links to unregistered users????

    thanks!!

  2. What links specifically?

  3. <?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: http://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');
    
    ?>
  4. 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.

  5. You could wrap your links in code like this:
    http://bbpress.org/forums/topic/check-if-a-user-is-logged-in#post-19953

  6. 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!

  7. You must log in to post.