Labradoodle-360 Posted May 19, 2009 Share Posted May 19, 2009 Hey everyone, I would like to make a PHP if else statement so that if a user is NOT logged in it shows a "Login" button, and a "Register" button. When they login the "Register" disappears, and the "Login" becomes "Logout" And if someone is an Admin, for an "Admin" button to be added. Here is my current navbar code: <div class='capsule'> <a href='feed:<?php bloginfo('comments_rss2_url'); ?>'> <img border='0' align='top' alt='Comments RSS' src='<?php print bloginfo('template_directory') . "/images/rss-icon.gif"; ?>'> <span title='Subscribe to the RSS feed for the comments on this site'>Comments</span> </a> </div> <div class='capsule'> <a href='feed:<?php bloginfo("rss2_url"); ?>'> <img border='0' align='top' alt='Site RSS' src='<?php print bloginfo('template_directory') . "/images/rss-icon.gif"; ?>'> <span title='Subscribe to the RSS feed for the posts on this site'>Site</span> </a> </div> <?php if( $options['showloginout'] == 1 ) { ?> <div class='capsule'> <?php wp_loginout(); ?> </div> <?php } ?> <div class='capsule'> <a href="" target="_blank" title="Forums">Forums</a> </div> <div class='capsule'> <a href="" title="Home" target="_self">Home</a> </div>Help would be appreciated! Help would be appreciated! Quote Link to comment Share on other sites More sharing options...
Labradoodle-360 Posted May 19, 2009 Author Share Posted May 19, 2009 This is for Wordpress. Quote Link to comment Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 Do you have a member system implemented in your site? If so, what kind of $_SESSION data (and with what array keys) are set when a user is logged in? Quote Link to comment Share on other sites More sharing options...
Labradoodle-360 Posted May 19, 2009 Author Share Posted May 19, 2009 Do you have a member system implemented in your site? If so, what kind of $_SESSION data (and with what array keys) are set when a user is logged in? Member system is, yes. I am fairly new to php, so where do I find what you need to know? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 19, 2009 Share Posted May 19, 2009 Add wp_register(); to wherever you want to show it. Quote Link to comment Share on other sites More sharing options...
Labradoodle-360 Posted May 19, 2009 Author Share Posted May 19, 2009 Add wp_register(); to wherever you want to show it. How do I get it to show to JUST non-members? Also, how do I show an Admin button to only Admins? Thanks! Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 19, 2009 Share Posted May 19, 2009 wp_register() should only show to non-members. If not, modify the source code. There isn't a way to check is someone is an admin, you can check if that person has permission to do something though. Quote Link to comment Share on other sites More sharing options...
Labradoodle-360 Posted May 19, 2009 Author Share Posted May 19, 2009 wp_register() should only show to non-members. If not, modify the source code. There isn't a way to check is someone is an admin, you can check if that person has permission to do something though. Really? How does SMF only show the Admin button to Admins? Also, how would I add "wp_register()" to my source? Thanks for the help! Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 19, 2009 Share Posted May 19, 2009 You're talking about Wordpress and now you're asking about SMF? And you just add it as is. Look at how wp_loginout() is added. Quote Link to comment Share on other sites More sharing options...
Labradoodle-360 Posted May 19, 2009 Author Share Posted May 19, 2009 You're talking about Wordpress and now you're asking about SMF? And you just add it as is. Look at how wp_loginout() is added. No, but there has to be some way to check if a member is an Admin or not. Thanks for the help! Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 19, 2009 Share Posted May 19, 2009 You can check if the user level is 10, which I think is the highest. There's no way to explicitly say someone is admin in Wordpress. It depends on what you mean. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.