buddybar menu add-ons
-
I have used a nice little snippet of code (thanks Burtadsit) to add a few items to the buddybar menu. I would like to be sure they are only visible when the user is logged in.
Now I need to know how to keep these new menu items hidden until a user is logged in.
Any ideas?
Here’s the code I found earlier:
How to modify the buddypress admin bar:
http://codex.buddypress.org/developer-docs/modifying-the-buddypress-admin-bar/
http://buddypress.org/forums/topic.php?id=2186 >> forum topic for discussion
Thanks!
-
I am looking to do the same thing, if you find a solution then please let me know:)
Wrap a button in
if ( is_user_logged_in() ) {
and}
. Only logged in users will see it.Hey Boone, is there a way to do something like if a logged in user clicks the button he goes to /blabla and if a guest clicks the button he goes to /registerfirst?
Add an else statement to the code Boone posted.
<?php if(is_user_logged_in()) : ?>
<a href="LINK TO WHERE YOU WANT THE LOGGED IN USER TO GO"><img src="YOUR BUTTON" alt="" /></a>
<?php else : ?>
<a href="LINK TO WHERE YOU WANT PEOPLE WHO ARE NOT LOGGED IN TO GO"><img src="YOUR BUTTON" alt="" /></a>
<?php endif; ?>Sorry for the caps!
Thanks r-a-y!
They might work for a button but, what about a function like so……
//*********Site Navigation*********//
function site_nav_links(){ ?> Explore <ul class=”your-ul-list-css-classname”> Blog Members <li class=”alt”>Groups Forums <li class=”alt”>Blogs <?php }
I tried a hundred ways and all I get is a white screen. I am not sure if I am writing the loggin user part correctly or not. The above function works well for the public but, once you try to hide it from the public it goes blank. I have almost given up.
- The topic ‘buddybar menu add-ons’ is closed to new replies.