[resolved] if isset: user data & if logged in. (1 post)

  1. purplemannequin
    Posted 8 years ago #

    I'm adding a static div to my blog.
    the div includes, some quick links, a salutation to the user, and some account quick links.

    what i'm trying to do is, if the username is set (logged in), echo it, and if not then echo 'guest'.
    also if the username is set (logged in), echo a logout link.

    and when user is not set (not logged in), echo a log-in form in place of the logout link.

    does anyone, know how to do this?
    so far i have the username appear when its set, but i'm not sure how to get it to echo 'guest' if it's not set (logged in).
    and i have no progress in the direction of the logout link/login form.

    this is what i have so far:

    <div id="static">
    	<div id="overhead">
    	<a href="/" title="Home | PurpleMannequin.com"><img alt="home" src="http://purplemannequin.com/blog/wp-content/themes/pm/images/home.png" /></a>
    	<a href="/" title="Feed | PurpleMannequin.com"><img alt="feed" src="http://purplemannequin.com/blog/wp-content/themes/pm/images/feed.png" /></a>
    	<a href="/" title="Contact | PurpleMannequin.com"><img alt="contact" src="http://purplemannequin.com/blog/wp-content/themes/pm/images/email.png" /></a>
    	<a href="/" title="Info | PurpleMannequin.com"><img alt="about" src="http://purplemannequin.com/blog/wp-content/themes/pm/images/info.png" /></a>
    	<div id="salutation">
    	<?php 	global $userdata;
    		echo('<b>hello, ' . '<i>' . $userdata->user_login . '</i></b>!');

    Any and All help is appreciated.
    Please and Thank you. :]

Topic Closed

This topic has been closed to new replies.

About this Topic