• hi there,

    i have the following code

    <a class="open" title="<?php _e('Open panel', 'sliding-panel'); ?>"><?php _e('Register or Login <span class="arrow">&darr;</span>', 'sliding-panel'); ?></a>

    What currently happens is when the user is logged out and in it still says ‘Register or login.’ I need it to say ‘Register or login’ when a member isnt logged in but ‘Dashboard’ for when they are.

    How do i rework the above with this similar script?

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • How about:

    <?php
    if( $user_ID ) $msg = 'Dashboard';
    else $msg = 'Register or Login;
    ?>
    <a class="open" title="<?php _e('Open panel', 'sliding-panel'); ?>"><?php _e($msg . ' <span class="arrow">&darr;</span>', 'sliding-panel'); ?></a>
    Thread Starter denzel2364

    (@denzel2364)

    Hi Esmi,

    Not sure that this would work because the a class triggers a jquery action (header slider). I think its ‘a class=”open”‘ that calls the action. I tried something similar with php echo.

    Thanks for your reply

    Thread Starter denzel2364

    (@denzel2364)

    Just been using this and noticed a missing apostrophe on ‘Register or Login’

    <?php
    if( $user_ID ) $msg = 'Dashboard';
    else $msg = 'Register or Login';
    ?>
    <a class="open" title="<?php _e('Open panel', 'sliding-panel'); ?>"><?php _e($msg . ' <span class="arrow">&darr;</span>', 'sliding-panel'); ?></a>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘php if user is logged in display this: Cant re-write to work. help?’ is closed to new replies.