WordPress.org

Forums

[resolved] Need IF statement in php (3 posts)

  1. ronthai
    Member
    Posted 1 year ago #

    Hi, I have this very small code that must be seen by Guests, but when they are logged in it is gone.

    I tried to mess around a bit, but I am no programmer/developer.

    This is the code:

    <div style="color: red; font-weight: bold; ">
    You have to be logged in to Upload attachments. <?php rh_hype_lilo();?>
    </div>

    Thanks, Ron

  2. WPyogi
    Forum Moderator
    Posted 1 year ago #

  3. ronthai
    Member
    Posted 1 year ago #

    Thanks, that helps a lot, I am almost there.

    But I need the little php code also to be gone when the user is logged in.
    I can not have a php in a php, apparently, so how do I get this php code gone when logged in
    <?php rh_hype_lilo();?>

    EDIT:

    Never mind solved it:

    <div>	 <?php
    if ( is_user_logged_in() ) {
        echo 'You are logged in and can upload attachments! ';
    } else {
        echo '<font color="#FF0000"><b>You have to be logged in to Upload attachments! </b></font>', rh_hype_lilo();
    }
    ?>  </div>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.