Skip to:
Content
Pages
Categories
Search
Top
Bottom

Link Cloaking

  • @motaboy21

    Member

    heyy

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

    thanks!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • @gerikg

    Member

    What links specifically?

    @kawauso

    Member
    <?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');

    ?>

    @chandersbs

    Member

    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.

    @johnhiler

    Member

    @motaboy21

    Member

    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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar