Skip Navigation

[Resolved] Conditions that check for a user field

This thread is resolved. Here is a description of the problem and solution.


The issue here is that the user wanted to conditionally display a user's field based on their previous field selection.


This can be done by using our views conditional statement.

An example of this can be seen below.

[wpv-conditional if="( '[types usermeta='user_phone' user_is_author='true'][/types]' eq 'public' )"]
Content goes here

Relevant Documentation:

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.


This topic contains 2 replies, has 2 voices.

Last updated by marcialB 9 months, 2 weeks ago.

Assigned support staff: Shane.


Hi there

We have a user field for the phone number. We display that phone number on each post, a user publishes.
[types usermeta='user_phone' user_is_author='true'][/types]
But we want to let users decide if they want their phone number to be public or not. I created a checkbox for the users.
I can let the result display with this shortcode: [types usermeta='user_phone_privacy' user_is_author='true'][/types]
I have set it to save "public" to the database if checked, and "0" if it's not selected.

However, I struggle to get the condition to work. I currently have it like this:
[wpv-conditional if="($(wpcf-user_phone_privacy) eq 'public' )"]
[types usermeta='user_phone' user_is_author='true'][/types]
However, I don't tell the condition to check in the authors' fields, therefore it doesn't work. How can I do that?

I tried to follow this thread but didn't quite get it:

Thanks for your help.




Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marcial,

Thank you for getting in touch.

I believe you should write the conditional like this.

[wpv-conditional if="( '[types usermeta='user_phone' user_is_author='true'][/types]' eq 'public' )"]

Content goes here


Please try this and let me know if it helps.



Hi Shane

Thanks a lot! I didn't know that I could use this shortcode for the conditions. That's great.