Skip Navigation

[Resolved] Help with Access

This support ticket is created 5 years, 2 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1374967

Tell us what you are trying to do?
I'm trying to limit views to certain users. I have Technicians (which are shop managers because we are using WooCommerce) and customers (subscribers) that the technicians visit. I want the customer to sign up for their account and pay for the maintenance agreement, then add a few details. After that the technician would add appliance details and service logs. I want the technician to see all the service logs and appliance details, but the customer to only see their own. Since the Technician is filling out their service logs, nothing shows up for the customer. I don't want the customer to see other customer details either.
Currently the author ID is the same as the user ID that is created by WooCommerce if that matters to this question.

Your help is greatly appreciated!

What is the link to your site?
hidden link
username: flywheel
pass: bxbmedia

#1375141

Hi, it sounds like you have several things going on here and I'm not sure where you want to start. I'd like to offer some general advice to start, and then get your feedback and we can go from there.

Access can handle restricting access to single post pages very effectively based on User role, but Access isn't well-integrated in Views. In other words, posts like yoursite.com/service-log/log1234 might be a single post created for a service log. You can apply post group restrictions to this single post very easily with Access. However, restrictions using post groups and User roles do not apply to the results of a View. So that log1234 post might be restricted from some User by post group, but it would still show up in a View of logs. There are some workarounds like the documentation shows here: https://toolset.com/documentation/user-guides/using-access-to-hide-certain-posts-from-view-results/
Just be aware that by default, a View's results are not restricted by Access the same way a single post page is restricted.

You mentioned that you want to associate both technicians and customers with a post, so you can filter a View's results to apply only to those Users. There are basically 3 ways to associate Users and posts:
- Post author works well but only for a single User, because WP only allows one author by default. You can't connect both a technician and a customer as post author, so this isn't helpful.
- Custom field value is okay but difficult to manage. For example, you can create a repeating number field on the post that holds User IDs. Each of those Users would be associated with that post. A View of posts could filter by this custom field and compare it to the current User's ID. If the User's ID is in that repeating field, you would show some content. If not, you would hide that content. Management of this field is difficult, because it means you need to go into wp-admin and figure out the numeric ID for each User you want to associate with a post. There's no easy way to type a User's name and automatically get them associated with the post, it's a manual tedious process.
- The third way is a proxy post type for Users: https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/
This approach allows you to create a substitute post for each User (a proxy), which you can then use in Toolset post relationships, in custom searches, and so on.

I think the proxy post type is a good idea for your case because it would give you the ability to associate multiple Users with one post. Then you can filter your Views using post relationships. You would still combine that with Access restrictions for single posts/pages.

You can see there's a lot to cover here, so please let me know your thoughts and we can try to pin down some specific tasks we can break into individual tickets.

#1377639

I'm using the proxy post type for Users option. I have it set up now that the technician choose from a dropdown of customers. I am working on Access restrictions. I'm sure I'll have more questions for you. Thanks for the help so far.

#1378111

You are quite welcome, I'll stand by for your update.

#1384665

My issue is resolved now. Thank you!