How To Control Access To Your Blog Content In The Blink Of An Eye

This post is using a new plugin called Hide This. You can get a copy from edwards.org. What it does is let your wrap content within your post in two special tags; <!--hidethis--> and <!--/hidethis-->. Then everything between those tags will be removed from your post before it is displayed to anyone who is not logged in as a subscriber to your blog.

This allows you to provide special subscriber only information embeded right in your posts so that you don't have the problems associated with some posts being available to everyone and some being hidden. It's a much more elegant solution to providing special subscriber only information within an otherwise public blog.

So what's in the hidden portion of this post?


Well, you'll have to get your



All Access Pass
to find out. It's free and easy.

Here's the subscriber only portion of this post. if you log out you'll see an ad in my sidebar asking prople to subscribe to this blog to be able to see this content. And, incedentally, you won't see this portion of the post any more.

The way I accomplished this is by using the following code.

<?php global $user_login;
get_currentuserinfo();
if( empty($user_login)) { ?>
<li><br /><br /><h2>All Access Pass</h2>
<a href="http://danemorgan.com/wp-register.php" title="Get Your All Access Pass Here!">
<img src="http://danemorgan.com/images/all-access-pass.jpg" /></a><br />
<a href="http://danemorgan.com/wp-register.php" title="Get Your All Access Pass Here!">
Get your All Access Pass to DaneMorgan.com</a>
- Many posts here have special subscriber only information.
When you get you <strong>free all access pass</strong> these special sections will be instantly available to you.
You'll also be instantly notified of new posts and receive special Pass Holder Only notifications and
information.<br />
<a href="http://danemorgan.com/wp-register.php" title="Get Your All Access Pass Here!">
Get Your All Access Insider Pass Now!</a>
</li>
<?php } ?>

What this does is check to see if the current user has a username associated to them. If they do, then it skips the html between the php statements, but if they don't it gets included. Since if you have a username you are by default logged in, I don't need to tell you about subscribing, so I hide it from you.

Trackback URL for this post:

http://danemorgan.com/trackback/119
None
Login or register to tag items
 
Posted In
Tagged With
Like this?
Bookmark & Share:
StumbleUpon Submit to Mixx Save to Google Bookmarks Save to del.icio.us
Click, Copy and Link:
<a href="http://danemorgan.com/blog/wordpress/how-control-access-your-blog-content-blink-eye">How To Control Access To Your Blog Content In The Blink Of An Eye</a>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Restrict text by wrapping in [restrict:roles=<comma separated roles>] and [/restrict]
  • Links to specified hosts will have a rel="nofollow" added to them.

  • Highlight terms in this textarea.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".
  • Use <fn>...</fn> to insert automatically numbered footnotes.
  • You may link to webpages through the weblinks registry

More information about formatting options

CAPTCHA
Please fill out this captcha to demonstrate your humanity.
5 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.