Hide content on a page until Log-In

Permalink 1 user found helpful
I have a client who wants to have a forum on her site. What she wants to do is have the forum on a page but not have it visible until the user logs in. I'm able to hide a page so its not visible until log-in but can I hide certain content on a page until the user is logged in.

PassionForCreative
View Replies: View Best Answer
melat0nin replied on at Permalink Reply
melat0nin
That's easy enough:

<?php
  $u = new User();
  if($u->isRegistered()); {
      // stuff to show when logged in 
  }
?>


I got that from here:http://www.concrete5.org/documentation/introduction/cheat-sheet...
PassionForCreative replied on at Permalink Reply
PassionForCreative
Thanks melat0nin, I can't seem to figure out what tag to place in to show the forum.

Also, would I have to add a HTML block & enter it this way?
Mnkras replied on at Permalink Reply
Mnkras
just make it so that guest cannot view, it, but maybe stick an external link or a landing page that if they are logged in redirects them to the forum
Cyberdave replied on at Permalink Reply
Cyberdave
I am trying to hide a div using this method.

Like so:

<?php
  $u = new User();
  if($u->isRegistered()); {
        <div id="extra-btns-wrap"><a href="url here">ADD LOTTO RESULTS</a></div>
  }
?>


but it not working I get an error message. Anybody know what I'm doing wrong? Thanks
12345j replied on at Permalink Reply
12345j
id just use advanced permissions to do this. add
<?php define('PERMISSIONS_MODEL', 'advanced'); ?>
to site.php and youll have a lot more options on permissions and control.
Mnkras replied on at Permalink Reply
Mnkras
cyber dave look at the guest views package, its free in the Marketplace, and it would be if($u->isloggedin())

if you look in the guest views package remove the ! before $u->isLoggedin() or you can use advanced permissions
SVijay replied on at Permalink Best Answer Reply
SVijay
Hi,

You should enable advanced permission for your requirement. To enable advanced permission add the following code in config/site.php file

<?php define('PERMISSIONS_MODEL', 'advanced'); ?>


go to edit mode, click on the block, select set permissions and select Read for registered users, thats it you are done.

For more details regarding permissions visit the given links -

http://www.concrete5.org/documentation/general-topics/simple-permis...