Login

Enter your username and password below to login. Forgotten your password? Click the link below to reset it.

How to conditionally display or hide content in a View based on user meta?

By: Julius hernández | Asked: 28/10/2021
ForumsCategory: How-toHow to conditionally display or hide content in a View based on user meta?
Julius hernándezJulius hernández asked 3 months ago

I need to display columns in a grid, based on current user meta. Think of it as if there are several price fields and I need that certain users only see a given column.
The user meta field is user_prices_view, and the values can be "regular price", "sale price" or "customer price".
The admins set any value they need to any user. Now, if when a View is shown for a user with "regular price" in meta, that user only sees the column with price A field; user with "sale price" only sees column with price B field, and obviously user with "customer price" only sees column with price C field.
In the View code I tried with something like:
[if current_user_meta="sale price"][sale_price][/if current_user_meta]
[if current_user_id show="user_prices_view" equals="sale price"][sale_price][/if current_user_meta]
...with no success.
The problem is there are no built-in conditionals to check user_meta values (set with Formidable Registration add-on). Some ideas?

Kuba S replied 3 months ago

I use this plugin for such stuff. https://www.role-editor.com/
It looks outdated but is extremely useful and does the job.

1 Answers
Paul Yates answered 2 months ago

You could try the custom content shortcode plugin which has a [is role=][\] shortcode that might help.

By Us. For Us.

This community site has been built by Formidable Forms users for Formidable Forms users. If you have any suggestions or would like to get involved please get in touch.
Join the community
crossarrow-right