• We often wish to provide some teaser content to visitors while keeping a part of the content reserved for registered users so that they will be lured to register on our site. This plugin helps you achieve exactly this. You will be able to mark a part of your post as private and the rest will be available to public and a register or login link will appear where your privatized content is supposed to appear. Once the user logs in they will be able to see the whole content (Great for membership sites). Now you can show off parts of your site to visitors and reserve parts for registered users.

    Download Link : http://smartlogix.co.in/wp-private/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Namith Jawahar

    (@namithjawahar)

    Seems related…I just downloaded and checked what hidepost does…

    This is the fun with wordpress…90% of the things you need will already be done and shared by someone else…I love wordpress for that..

    Anyways I would recommend wp-private to newbies who just want the functionality shown above and hidepost to advanced users who wish for more control

    You plugin is also very similar to http://alanwho.com/web-development/wordpress/plugins/protectcontent/ which is no longer supported, but was this code:

    add_filter('the_content', 'protect_content');
    
    function protect_content($content) {
    global $current_user, $user_ID;
    
    if (($current_user->id == 0) && ($user_ID == 0)){
    
    $b = strpos($content, '<!--protectcontent-->');
    
    $e = strpos($content, '<!--/protectcontent-->');
    
    	$pre = substr($content,0,$b);
    	$suf .= substr($content,$e,strlen($content));
    
    	return $pre.$suf;
    
    } else { return $content; }
    
    }
    
    ?>

    And the plugin Hidethis had this code:

    add_filter('the_content', 'hide_some_content');
    
    function hide_some_content($content) {
    global $current_user, $user_ID;
    
    if (($current_user->id == 0) &amp;&amp; ($user_ID == 0)){
    
    	$b = strpos($content, '<!--hidethis-->');
    	$e = strpos($content, '<!--/hidethis-->');
    
    	$pre = substr($content,0,$b);
    	$suf .= substr($content,$e,strlen($content));
    
    	return $pre.$suf;
    
    } else { return $content; }
    
    }
    
    ?>

    Another wonder of WordPress–how many times coders come up with almost the same exact code.

    Code from wp-private:

    add_filter('the_content', 'protected_content');
    
    function protected_content($content) {
    global $current_user, $user_ID;
    
    if (($current_user->id == 0) &amp;&amp; ($user_ID == 0)){
    
    	$begin = strpos($content, '<!--protected-->');
    	$end = strpos($content, '<!--/protected-->');
    
    	$prefix = substr($content,0,$begin);
            $message = '<div id="wp-private-box"><b>This is protected content. Please <a href="' . get_option('siteurl') . '/wp-login.php">Login</a> or <a href="' . get_option('siteurl') . '/wp-register.php">Register</a> for access.</b></div>';
    	$suffix .= substr($content,$end,strlen($content));
    
    	return $prefix.$message.$suffix;
    
    } else { return $content; }
    
    }
    
    ?>
    Thread Starter Namith Jawahar

    (@namithjawahar)

    Wp-Private no longer parses and then processes the post content to search for sections to block.

    As of V1.3 I have added a bunch of customization options as well as moved the whole thing over to wordpress shortcode API.

    Hope everyone find the new changes usefull..
    Drop in a line at the wp-private tutorial site about your comments or suggestions.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Make part of posts private’ is closed to new replies.