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

  1. ronthai
    Posted 2 years 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();?>

    Thanks, Ron

  2. WPyogi
    Forum Moderator
    Posted 2 years ago #

  3. ronthai
    Posted 2 years 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();?>


    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


No tags yet.