Skip Navigation

[Waiting for user feedback] Can I show a list of posts based on user category?

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 4 replies, has 2 voices.

Last updated by Christopher Amirian 3 days, 5 hours ago.

Assisted by: Christopher Amirian.

Author
Posts
#2763363

Tell us what you are trying to do?
When a user creates a profile on the site they need to selects some categories.
Example:
User 1 selects category A, C, E on account registration
User 2 selects category B, D on account registration

When user 1 goes to a CPT listing, they should only see posts with category A, C, E
When user 2 goes to the same CPT listing, they should only see posts with category B, D

Is there any documentation that you are following?
I haven't been able to find documentation that resolves this issue.

Is there a similar example that we can see?
I don't have an example

What is the link to your site?
Site is in development.

#2763483

Christopher Amirian
Supporter

Languages: English (English )

Hi,

There is no such feature available in Toolset.

You can use the Toolset access to set a post group to limit access to posts but it should be added by the admin of the website in the WordPress Dashboard and not by the user itself ins9ide a registration form:

https://toolset.com/course-lesson/setting-access-control/

Implementing such feature is outside of our support scope and you can consider hiring a developer for that:

https://toolset.com/contractors/

Thanks.

#2763538

What about if I have User 1 and the user has a "company" CPT (Company 1)
The company has the following categories assigned to it: A, C, E

When the user views a list of all posts, the loop query get's the user's company categories and only shows the posts that share the same categories as the user's company?

So, based on the user, the company category get's passed to the query.

Is that possible?

#2765271

?

#2765279

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Your first sentence can be done. That is creating a post type and assigning a user to the post type entry by setting it as the author of that post type.

You can learn more about that here:

https://toolset.com/lesson-placement/lesson-placements-1622969-1929573/

The second part will be somehow set the custom post type entry for the user (company 1) to get categories that the user wants.

That is not what Toolset can do and it needs custom development. You might need to add generic fields for the form and intercept the form with cred_save hook and get which categories the customer selected. Then you will be able to assign those categories to the entry in question via code.

But is is way outside of our support scope. You can learn more about cred_save here:

https://toolset.com/documentation/programmer-reference/cred-api/

Thanks.