Skip Navigation

[Résolu] Toolset Access question: restrict for individual users, rather than roles?

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 5 réponses, has 2 voix.

Last updated by Christian Cox Il y a 1 an et 6 mois.

Assigned support staff: Christian Cox.

Auteur
Publications
#1537761

Your page https://toolset.com/home/types-access/ says that the plugin can "Grant privileges to entire user roles or to specific users." How would I be able to restrict a specific post, so that only one specific user may view it?

Custom post type "customers" - each of our customers will have its own post displaying Views and other content specific to that customer. I'd like to have Customer A log on and only be able to see the /customer_a/ post, etc.

I am finding how to restrict the custom post type to a user Role, but I don't want Customer B to view Customer A's post and vice versa. Can this be done with Toolset Access?

#1537877

Hi, The Access method of restricting content per single User is not really practical in this case, since you would have to create and manage a separate post group per User. That's not likely to work in a real-world scenario like you have described. One practical way to approach this is to create a single generic Page like yoursite.com/my-profile, then use Views in that page to display information specific to the current logged-in User. That would prevent each User from viewing other Users' information. Otherwise, another easy approach here would be to allow each User to create a single Customer post with Forms, using the "Private" status. Each User would only have access to his or her own post this way, but not others' posts. The Form could be very simple, just a single button that says "Create profile" or something similar. You can see more about restricting Users to creating a single post here (see FAQ 1): https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

Let me know if you have questions about these approaches and I can give you more feedback.

#1537887

Christian, thank you.

I'd thought about making the user the Author of their corresponding post. I'd prefer the site Admin create the users manually (there won't be that many.) But it seems as though the "author dropdown", when enabled on the Edit Post Type screen, is only visible when the Editor is set to the Classic Editor. Am I missing something, or is there a way to choose/reassign the Author of a post when the post type is set to use the Block editor?

#1537891
Screen Shot 2020-03-03 at 4.22.47 PM.png

It should be there - check the Document tab? You may also need to enable it for this post type if it's a custom post type. You can do that in Toolset > Post Types, edit your CPT and find Author in the Options tab.

#1537921

Interesting. I turned off Author in the Edit Post Type screen, then turned it back on, then switched back to the Block Editor and only then did I get the desired result. It shows under Status & Visibility now, but it did not before. The Author dropdown is also showing if I click on Quick Edit from the All Items screen, which wasn't happening before either. Thanks for your help; I think I have a way to go about this now, revising my initial path somewhat to go the /my-profile/ route with Views set to the author of the post equalling the logged-in user. Thank you!

#1537927

Okay great, I'm closing here per your comments. Feel free to open a new ticket if you run into issues.