Jump to content

[SOLVED] Quick navbar if/else statement help


Recommended Posts

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.