0

Hi everyone and Good day!Am new to php and I have a problem with the code below.

<?php if (is_user_logged_in() ) //only logged in user can see this 'echo'<href="http://localhost/itsz.com/profile">Profile</a>';
?>

What i want it to do is to only show the link "profile" 'only' to logged in users but it doesen't. Instead, profile link is shown to both loggedin and non logged in users. i know i have made an error in the code syntax but i have no idea where. It was just a copy and paste game and edit a little.Php coders help me. Thank you.

Edited by Simunji: spelling error

2
Contributors
2
Replies
15
Views
2 Years
Discussion Span
Last Post by Simunji
0

Get rid of the single quotes around echo:

<?php if (is_user_logged_in() )
    echo '<href="http://localhost/itsz.com/profile">Profile</a>';
?>

However if it's showing in all cases, it means that is_user_logged_in() isn't working properly. For that we'd need to see the underlying code as we don't have crystal balls.

0

Wow! its now working like magic! Cant believe those damp '' troubled me for weeks. I need some basic php tutorials.Thanks and May God Bless youuu...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.