Check current login user
-
Good day all, Please help.
I try to change a list of info where it currently show all the user IDs, it should show “you” for the current logged in user in the list.
So I’m trying to use the if else statement but it does not show the user as you.Please see my code before the change:
<?php echo $result->id; ?>
This is working correctly and shows all the users IDs.
Here i is with my if else statement:if ($user = $result->id){
<?php echo You ?>;}
else {
<?php echo $result->id; ?> }
I have tried it with and without the {} brackets. I have even tried a JavaScript with the if else statement. And I also tried adding this$user = wp_get_current_user();
before the list, but it wont work.Here is the output I get:
if ($user = $result->id){ Notice: Use of undefined constant You - assumed 'You' in You} else { 39 } R5,000.00 2 days ago if ($user = $result->id){ Notice: Use of undefined constant You - assumed 'You' in You} else { 38 } R4,000.00 2 days ago
It is suppose to look like this
39 R5,000.00 2 days ago 38 R4,000.00 2 days ago 37 R2,500.00 2 days ago
Any help will be appreciated.
The page I need help with: [log in to see the link]
- The topic ‘Check current login user’ is closed to new replies.