Forums

How to do these things with the log out function? (1 post)

  1. TransPersonal
    Member
    Posted 3 years ago #

    Hi,

    Right now my login code looks like this:

    <?php global $user_ID; ?>
    <?php get_currentuserinfo(); ?>
    <?php if(! $user_ID){ ?>
    	<div id="loginbar">
    	<form name="loginform" id="menulogin" action="<?php bloginfo('wpurl'); ?>/wp-login.php?redirect_to=/home" method="post">
    		<label><?php _e('User Name') ?> <input type="text" name="log" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="10" tabindex="1" /></label>
    		<label><?php _e('Password') ?> <input type="password" name="pwd" value="" size="10" tabindex="2" /></label>
    		<?php do_action('login_form'); ?>
    		<input type="submit" name="wp-submit" value="<?php _e('log in'); ?>" tabindex="3" />
    		<input type="hidden" name="redirect_to" value="<?php echo attribute_escape($_SERVER['REQUEST_URI']); ?>main" />
    	</form>
    	</div>
    <?php } ?>

    and my log out code looks like this:

    <a href='<?php echo wp_logout_url(); ?>&amp;redirect_to=/home'>Logout</a>

    1. The problem is the logout link always shows even when no one is logged in. I want it to show only when someone is logged in.

    2. Also I want a register function to show when no one is logged in and for this to go away when someone is logged in.

    I have no php knowledge so if anyone can help I will greatly appreciate it.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags