Below code tested with Drupal 5, not sure if it works on Drupal 6, please let me know if you try it!
Just replace your $content variable with the code below, which is in your node.tpl.php file located in your themes folder. Apologies if anyone finds fault with the below, it works, and I couldn’t find any code on the internet for it, being not a programmer it could be a little ugly, but it does work ;)
<?php if ($teaser): ?><?php global $user; // if visitor is not logged in if (!$user->uid) { // print the teaser print $content; } else { // if user is logged in print the teaser print $content; } ?><?php elseif (!$teaser): ?><?php global $user; // if anonymous visitor and content type is all except blog or page if (!$user->uid && $node->type != 'blog' && $node->type != 'page') { // lock anonymous visitors out of the full article print("<div class='messages'>Please <a href='/user/register'>register</a> or <a href='/user'>login</a> to view images!</div>"); } else { // show all content for all content types to logged in users print $content; } ?><?php endif;?>
Done!
Tweet this: Tweet |
cctv karachi
It’s glad to see good information being convey. Its a very nice written, and i really like these blog. Thanks for the info.
From this article: Stockxpert contributors begin to pull out | Comment: #