Info
- 8 posts
- 4 voices
- Started 4 years ago by Thrift
- Latest reply from Ohna
- This topic is not resolved
Hiding objects from registered and unregistered users.
-
- Posted 4 years ago #
I'd like to hide the login/pass fields after a user has logged in and there are some other things I would like to hide or be available only to registered users.
Can anyone help?
-
- Posted 4 years ago #
Ok, I so figured out the <?php if ( bb_is_user_logged_in() ) : ?> tags to display items to users that are logged in. Now how can it be used to hide things from people that are logged in?
There is a lack of documentation on functions it seems. That or I'm just not looking in the right places.
-
- Posted 4 years ago #
Not tried this but usually with functions you can put in an exclamation mark in to what you had for not logged in.
<?php if ( !bb_is_user_logged_in() ) { ?>
show to those not logged in
<?php } ?>Sorry if that's obvious and you've already tried it.
-
- Posted 4 years ago #
Thank you!
I'm still a little new at this so I appreciate the help with what was more then likely a very simple question. It worked after I modified it a little.<?php if ( !bb_is_user_logged_in() ) : ?>
show to those not logged in
<?php endif; ?> -
- Posted 2 years ago #
In which file should I make the modification <?php if ( bb_is_user_logged_in() ) : ?> and where so that unregistered users CANNOT see the forums or the topics?
-
- Posted 2 years ago #
Hi, dan90036
Try this:
<?php if ( bb_is_user_logged_in() ) : ?> HTML content for registred user <?php else : ?> HTML content for unregistred user <?php endif; // bb_is_user_logged_in() ?> -
- Posted 2 years ago #
Thank you Ohna, one question in which file and where should I put this snippet of code?
Dan -
- Posted 2 years ago #
I think this isn't the best practice but you can try this for the moment:
If you use a custom template, edit with a text editor:
my-templates/(name_of_your_templates)/front-page.phpafter:
<?php bb_get_header(); ?>
add:
<?php if ( bb_is_user_logged_in() ) : ?>
before :
<?php bb_get_footer(); ?>
add :
<?php else : ?> <?php if ( !in_array( bb_get_location(), array( 'login-page', 'register-page' ) ) ) login_form(); ?> <?php endif; // bb_is_user_logged_in() ?>do the same for:
my-templates/(name_of_your_templates)/topic.php
my-templates/(name_of_your_templates)/forum.php
my-templates/(name_of_your_templates)/profile.php
my-templates/(name_of_your_templates)/tags.php
my-templates/(name_of_your_templates)/tag-single.php
my-templates/(name_of_your_templates)/view.phpbut your forums posts can allways be read trough the rss feed..
-
You must log in to post.