Support » Fixing WordPress » How do i know when someone is logged in?

Viewing 6 replies - 1 through 6 (of 6 total)
  • fredrik

    (@fredrik)

    Maybe you can use the function that is already in WP when for example the admin navigation buttons are showing depending on if you’re logged in or not?

    ATENCION

    (@atencion)

    That´s a good idea, fredrik. Thanks for replying.

    I¨m there, looking for some function wich might be useful but to be honest I´m quite lost and I´m not finding anything that I could tell it´d work.

    Do you have any idea on what exactly to look for? I´m guessing is some sort of conditional, but I don´t really know.

    fredrik

    (@fredrik)

    ATENCION

    (@atencion)

    Thank you very much!…
    I think I´ve figured it out …at least it´s working..

    I just check if the $user_ID string has nothing ..

    Here´s how..

    <?php
    if ($user_ID==”) {
    ?>

    “SHOW SOMETHING FOR NON-REGISTERED USERS HERE”

    <?php
    } else {
    ?>
    “SHOW SOMETHING FOR REGISTERED USERS HERE”

    <?php
    }
    ?>

    Alex Mills

    (@viper007bond)

    Correct code would be:

    if (!$user_ID) {

    Jason

    (@vxjasonxv)

    Alternatively,
    if (empty($user_ID)) {

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How do i know when someone is logged in?’ is closed to new replies.