WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Need IF statement in php

[Resolved] Need IF statement in php

  • 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

Viewing 2 replies - 1 through 2 (of 2 total)
  • WPyogi

    @wpyogi

    Forum Moderator

    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>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Need IF statement in php’ is closed to new replies.