I am trying to show hide element dependitly if user is logged in inside a views loop. Normally there is no issue with it, but since the last update i begin to noticed even on my older sites (where it used to work), that the conditional shortcode for logged in users is not working..
i tried both following conditionals:
[wpv-conditional if="( '[wpv-current-user info='role']' eq 'administrator' )"]
Logged in 0
[/wpv-conditional]
[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'true' )"]
Logged in 1
[/wpv-conditional]
[wpv-conditional evaluate="false" if="('[wpv-current-user info='id']' eq '')"]
Logged in 2
[/wpv-conditional]
[wpv-conditional if="( '[wpv-current-user info='login']' eq 'true' ) "]
Logged in 3
[/wpv-conditional]
Nothing is working!!
Hi, if you simply want to test whether or not the current site visitor is a logged-in User or not, either of these should be effective:
[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'true' )"]
Logged in 1
[/wpv-conditional]
[wpv-conditional evaluate="false" if="('[wpv-current-user info='id']' eq '')"]
Logged in 2
[/wpv-conditional]
If those two shortcodes are not working as expected, please add debug="true" to the shortcodes and test again:
[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'true' )" debug="true"]
Logged in 1
[/wpv-conditional]
[wpv-conditional evaluate="false" if="('[wpv-current-user info='id']' eq '')" debug="true"]
Logged in 2
[/wpv-conditional]
Please share the output from these debug tests in your next reply.
This conditional would only work if you are logged-in as an administrator with no other secondary user roles:
[wpv-conditional if="( '[wpv-current-user info='role']' eq 'administrator' )"]
Logged in 0
[/wpv-conditional]
If you are logged-in as administrator and your admin User has no other User roles, please add debug="true" to the conditional and test again. Share the results in your next reply.
[wpv-conditional if="( '[wpv-current-user info='role']' eq 'administrator' )" debug="true"]
Logged in 0
[/wpv-conditional]
The info="login" in this context is not the login status, it is the username - also known as the user's login. So this conditional cannot help you determine login status except for one User with username "login".
[wpv-conditional if="( '[wpv-current-user info='login']' eq 'true' ) "]
Logged in 3
[/wpv-conditional]
One thing to note: debug information will never appear for Guest users, so it is useless for testing Guest scenarios.