Dear Sir/Madam,
I want to set the condition if user is logged in. Please advise how I can do.
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Kelvin,
Thank you for getting in touch.
Based on your message you want to display something to only logged in users correct?
You conditional statement is contradicting this. Please clarify for me.
Thanks,
Shane
Dear Shane,
I only show you where I want to enter the statement, could you please show me the correct statement that I can check whether the user is logged in or not ?
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Kelvin,
If you want to check if the user is logged in you will check against their logged in status.
So the statement will be
( ( '[wpv-current-user info="logged_in"]' eq 'true' ) )
This will check if the current user is logged in.
Thanks,
Shane
Dear Shane,
Your statement will auto be changed to
( ( '[wpv-current-user info="id"]' eq 'true' ) )
I tried below two statements but not work.
( ( '[wpv-current-user info="id"]' eq 'false' ) )
or
( ( '[wpv-current-user info="id"]' ne 'true' ) )
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Kelvin,
The statements below should work. I went ahead and revised and tested both and they work on my end.
To display items to users who are logged out
( empty( '[wpv-current-user info="id"]') )
To display items to users who are logged in.
NOT ( empty( '[wpv-current-user info="id"]') )
Please let me know if they both work for you.
Thanks,
Shane