Home›Toolset Professional Support›[Resolved] What are the options for displaying different content to different users on the front-end?
[Resolved] What are the options for displaying different content to different users on the front-end?
This thread is resolved. Here is a description of the problem and solution.
Problem:
What are the options for displaying different content to different users on the front-end?
Solution:
To display different content on the front-end according to some criteria you essentially have two options.
If the thing being tested relates to the person doing the looking (the user browsing the website is registered and has a certain role because they have paid for a particular membership, for example) then you can use Access to restrict the visibility of whole pages, or to selectively show certain content on a page (as described here: https://toolset.com/documentation/user-guides/access-control-texts-inside-page-content/).
If the thing being tested relates to the thing being looked at then you would need to add custom fields to the content being viewed and then use the wpv-conditional shortcodes to test the content of those custom fields and selectively display what is wrapped in the shortcode, as described here: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.
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.
- Listing (aka YELP! kind) site.
- ‘Places’ (business) information's should be collected via CRED by all existing/available fields.
- Some of the fields are of ‘Premium’ (paid) characteristic. ie contact data, photo gallery, map direction, …., what determinate visibility of fields on website.
- First CRED question is about ‘membership’ level, like ie ‘FREE’, ‘Map paid’, ‘Contact paid’, ‘Premium’ (all fields visible).
- Membership, certainly should be available to be easy switchable by backend, by Administrator.
QUESTION
- What is the best concept (is it some reference website?)?
To try to help.
a) Try to handle it (fields visibility) via ‘membership’ (ACCESS). If YES, some brief lead points please.
b) Try to handle it via ‘conditional logic’ of first ‘membership’ field. If YES, some brief lead points please.
c) Some other option.
Note that with CRED forms you can selectively display fields according to the selection in another field, but this is just done with JS and the fields are hidden with CSS, which does not meet your requirements.
You would need to create multiple variations of the CRED form to publish content and which one you linked to would depend on the role of the user (with different roles for users with different membership levels).
Try reading through the training materials, it will give you a good overview of what is involved.
You can then ask again if you have specific questions.
Thanks for reply. It helps for begin, but my question is about something what (let's to call it) should to dynamically enable switch of frontend view of context (elements of) of the page.
Example
If client paid this month, his contact data will be publicly visible on the page, if not paid, it will be disabled from the page content (so, maybe other View or what, how?).
So, regards the CRED, user should be able to enter ALL AVAILABLE DATA (in fact, it will be done by administrator/author, but is not a substantial difference), but view of those data depends on monthly payment base.
I guess that right way is Access and my question now is only to indicate me is it right or not. As you wrote, if that is the right way, I will study it and eventually than ask what I can't solve. Now is about the CONCEPT (using Access or some other way).
It looks simple to point solution to Access, but in reality, it is not about USER ROLE, as it is about CONTENT VIEW of the client (as it should to be managed by administrator or preferably, automatically). I don't want to say, that it cannot be solved by USER ROLE (assign it to client, but without login access) and EXACTLY for that reasons I asked this question. I just say that it is not in REALITY about users (as they should not to have access to any kind of login), it is exactly about the content view vs some parameters (fields will be separated by Field Groups/Metaboxes, for easier work). So, some metaboxes should be sometimes visible and sometimes not.
If you are talking about displaying only certain content on the front-end according to the payment status of the user, well this depends slightly on where you are displaying the data.
Let's say you are showing user profiles, and the data is in the form of custom user fields which you use to build an extended profile.
You would need to do something like this to display the user profile on the front-end.
Create a View which lists users. In the Loop Output section link to a page where you are going to display the user profile, and add a URL parameter for the user ID (e.g. userid). So the relevant part of the Loop Output would look something like this:
<a href="[wpv-post-url id='2']?userid=[wpv-user field="ID"]">Profile of [wpv-user field="display_name"]</a>
You would edit the id of the page you were linking to (currently '2').
Then on that target page you would insert another View which will display the user profile for the chosen user.
So this View also returns users, but includes a Query Filter to only show the user set by the url parameter userid (see screenshot).
Then you design the Loop Output section of this View to contain the content you want to appear in the profile (probably grouped together in a Content Template).
Your user fields need to include a custom field where you set the status of the user (i.e. whether they have paid and their contact details should be visible).
Sorry, issue could be in my poor English and terminology.
1) So, for now, I just ask what approach is the best for issue (concept) and you don't need to go deeper in explanation of technical details. I ask that for reasons to know how to build CPT/fields/taxonomies.
2) I DON'T want to explicitly condition or connect the 'Place' (business) with User, what don't necessarily mean that it is not acceptable for me as solution. In other words, 'Places' will be populated by Authors and not by owners of 'Places', what also not necessarily mean that it will not be in future done by owners (I simply don't know that now).
So, if you think that above (by you) explained solution is the BEST OPTION, I understand above explanation and we can close the ticket, otherwise youo can expose to me some other eventually most appropriate option/solution.
Well, I understand the key part of your question to be about displaying different content on the front-end according to some criteria, and for that you essentially have two options.
If the thing being tested relates to the person doing the looking (the user browsing the website is registered and has a certain role because they have paid for a particular membership, for example) then you can use Access to restrict the visibility of whole pages, or to selectively show certain content on a page (as described here: https://toolset.com/documentation/user-guides/access-control-texts-inside-page-content/).
If the thing being tested relates to the thing being looked at then you would need to add custom fields to the content being viewed and then use the wpv-conditional shortcodes to test the content of those custom fields and selectively display what is wrapped in the shortcode, as described here: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
Undertanding those two options I think you should be able to decide which suits your project best.