Viewing 4 replies - 1 through 4 (of 4 total)
  • pankaj_kumar036

    (@pankaj_kumar036)

    <?php if ( is_user_logged_in() ) {
    	   global $user_login;
            get_currentuserinfo();
    
    ?>
    <div id="loginInfo" width="100%" style="text-align:right;">
        <!-- text that logged in users will see -->
    <span style="margin-right:22px">Welcome <?php echo ucfirst($user_login); ?>    <a href="http://www.neweastsidecommunity.com" title="Logout">Log Out</a></span>
    </div>
    <?php
     }?>


    [Please use the code buttons when posting code here]

    I’M NOT ABLE TO REDIRECT ON THE LINK PAGE

    Pioneer Web Design

    (@swansonphotos)

    http://codex.wordpress.org/Function_Reference/is_user_logged_in

    <?php
    if ( is_user_logged_in() ) {
        echo 'Welcome, registered user!';
    } else {
        echo 'Welcome, visitor!';
    }
    ?>

    Start with above (and perhaps use PHP also to change some text?)

    http://codex.wordpress.org/Function_Reference/get_currentuserinfo

    is_user_logged_in() may not work, if the script is outside of wp folder ?? … yet, i am not sure about that.

    is_user_logged_in() may not work, if the script is outside of wp folder ?? … yet, i am not sure about that.

    Confirmed, I had the same problem and the dozen other threads on the internet did not have anyone mentioning this (or I didn’t read the manual right).

    Wrong Way
    ./test.php
    ./wordpress/wp-blog-header.php

    Correct Way
    ./wordpress/test.php
    ./wordpress/wp-blog-header.php

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘is_user_logged_in doesn't work’ is closed to new replies.