Forums

[resolved] Best way to do the following user_ID() (5 posts)

  1. denzel2364
    Member
    Posted 2 years ago #

    Hi there,

    i have this code:

    <?php if ( $user_ID ) {
                    <div id='changepicture'>
            		<a class='changepicture' href='#'>
                	    echo "Change Picture";
            		}
            		?>
            		</a>
    		</div>

    However, i have the div style still remains on the site.

    How can i wrap this around the div aswell? When i try it, it conflicts with the '"' speechmarks.

  2. Mark / t31os
    Moderator
    Posted 2 years ago #

    You can't just place HTML into PHP like you've done above..

    Try this..

    <?php if ( $user_ID ) { ?>
    	<div id='changepicture'>
    		<a class='changepicture' href='#'> Change Picture</a>
    	</div>
    <?php } ?>

    ...not sure that's what you were aiming for, i just fixed the code for you... ;)

  3. denzel2364
    Member
    Posted 2 years ago #

    ah ok, thank you so much.

    I just had a mental glitch and forgot that.

    Thank you, i have learnt something :-)

  4. Safirul Alredha (zeo)
    Member
    Posted 2 years ago #

    Some addition: switch $user_ID to is_user_logged_in()

    Same thing but much clearer. :P

  5. denzel2364
    Member
    Posted 2 years ago #

    ah thanks Zeo

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.