I am trying to: follow the CRED training course on this page https://toolset.com/documentation/user-guides/cred-training-course/part-7-building-account-page-login-form/
I'm using Layouts plugin.
I expected to see: the results as set out under "Separating between visitors and logged-in users"
Instead, I got:
When using a Visual Editor Cell Type and conditional output coding like this as detailed on the training page:
[wpv-conditional if="( '[wpv-current-user info='logged-in']' eq 'false' )"]I'm a Visitor[/wpv-conditional]<br />
[wpv-conditional if="( '[wpv-current-user info='logged-in']' eq 'true' )"]I'm Logged In[/wpv-conditional]
the page is empty for both logged-in and not logged-in users.
When using a Visual Editor Cell Type and conditional output coding like this:-
[wpv-conditional if="( '[wpv-current-user]' eq 'logged-in' )" evaluate="false"]I'm A Visitor[/wpv-conditional]<br />
[wpv-conditional if="( '[wpv-current-user]' eq 'logged-in' )" evaluate="true"]I'm Logged In[/wpv-conditional]
Both logged-in and not logged-in users see "I'm A Visitor"
If I use a Content Template cell instead, the same results occur but the text appears slightly lower down the screen (as if an empty line is returned for the option "I'm Logged In".
Any ideas please?
Thanks
That ShortCode option is not "logged-in" or "logged-out" but "logged_in" or "logged_out".
Actually, if you set the condition with the GUI, this will be automatically correct.
The correct Code is:
[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'true' )"]I am Logged in[/wpv-conditional]
[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'false' )"]I am not Logged in[/wpv-conditional]
This is also exactly how Agnes explains it in the tutorial.
Let me know if there are any typos there.
Aha I see; I used dashes instead of underscores! Thanks for spotting that.
Agnes' code works but if I use the GUI to set the conditions, it produces this which is slightly different to Agnes' code :-
[wpv-conditional if="( '[wpv-current-user]' eq 'logged_in' )" evaluate="false"]I'm A Visitor[/wpv-conditional]<br />
[wpv-conditional if="( '[wpv-current-user]' eq 'logged_in' )" evaluate="true"]I'm Logged In[/wpv-conditional]
and produces the right output if not logged in but the wrong one if logged in.
I'm happy to use Agnes' code but curious as to why the code generated using the GUI doesn't work correctly.
See what the steps Agens indicate:
Separating between visitors and logged-in users > step 5.
You have to edit this ShortCode.
Much simpler is to highlight it (the [wpv-current-user] part) and then click on Fields and Views.
Find the "Current user" and click on it.
You will see major options appear.
One of them is Logged in.
Check the radio and insert the ShortCode.
Now it should look like in the Tutrial and also work.
In future the Conditional Display GUI will support options of ShortCodes but not yet.
Right now you need to edit it manually or use the "Fields and Views" GUI.