Support » Plugin: SimpleModal Login » Display – Welcome "name" once logged in?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Check the is_user_logged_in function

    Thanks for the reply, my code at the moment is placed in my page.php and looks like

    <div class="loginpopup">
    <a href="/wp-login.php" class="simplemodal-login">Log In</a> <strong>|</strong>
    
    <a href="/wp-login.php?action=register" class="simplemodal-register">Register</a>
    </div>

    I am not very good with php, how would i implement your link into my above code? or is it placed in the functions.php?

    Sorry im just confused. cheers

    Something like this:

    <div class="loginpopup">
    <?php if ( is_user_logged_in() ) { ?>
    // welcome message goes here
    <?php } else { ?>
    <a href="/wp-login.php" class="simplemodal-login">Log In</a> <strong>|</strong>
    <a href="/wp-login.php?action=register" class="simplemodal-register">Register</a>
    <?php } ?>
    </div>

    Thanks mate, will give it a go in a minute, where you have: –

    // welcome message goes here

    Will that need to be something like the below: –

    echo 'Welcome, registered user!';

    Or <p>Welcome</p>

    How would you pick up the registered users name/id?

    Welcome, “Paul”

    I have managed to get it to work using the following, but i would like to get the Option to “Log out” once they are logged in eg:

    “Welcome Paul, logout”

    Here is the code i have so far:

    <div class="loginpopup">
    	<?php  if (is_user_logged_in()) {
              $user = wp_get_current_user();
              echo 'Welcome <strong>'.$user->display_name.'</strong> !';
    							} else { ?>
    		<a href="/wp-login.php?redirect_to=<?php echo $_SERVER['REQUEST_URI']; ?>" class="simplemodal-login">Log In</a> <strong>|</strong>
    		<a href="/wp-login.php?action=register" class="simplemodal-register">Register</a>
    	<?php } ?>
    </div>

    And here is the logout code link i cant seem to add in the above, it keeps killing the page: –

    <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>

    Can anyone help,cheers

    Have you got it to work know???

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display – Welcome "name" once logged in?’ is closed to new replies.