Skip Navigation

[Resolved] Split: How to restrict access to the form for specific user 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2614959

"Additional requirements:

3. Since the form for changing user roles is on a custom post published by the author, how can I restrict the accesss of those user roles only to that specific post for the logged-in user?" (Example:The owner of a gym publishes a custom post/listing of his gym, and a logged-in user wants to sign up as a trainer, trainee, assistant, etc., so only for that specific custom post of a particular author."

Hope this is not too much...
Regards,

Sinisa

#2614979

Thank you so much for the work done. Just to emphasize, under point 3, what I want is that AFTER submitting the CRED form on a specific post, those user roles and the access they allow should only apply to the that user who submitted the form and only for that post.

#2615017

Hi,

> those user roles and the access they allow should only apply to the that user who submitted the form and only for that post.

- The scope of a user's role is site-wide, which means it can't be set for a specific page/post level. To control grouped access for specific pages/posts, you can use the 'post group' feature:
https://toolset.com/lesson-placement/lesson-placements-1621543-1655635/#create-a-post-group-for-pages-restricted-to-logged-in-users

If you could share the details about the planned structure of the website, I'll be in a better position to suggest an alternative approach.

regards,
Waqar

#2616135

It's not about a complex structure, but rather a simple listing of an individual author who is seeking people for his promoted service. People apply to the author's listing (registered users to a custom post) and through a CRED form, they choose in which role they want to participate. User roles are predefined across the entire website for all posts, but the issue is how to limit access and capabilities for registered users only to the specific listing (custom post of the author, granular access to individual posts), exclusively to the post they applied to as filled out the CRED form with user roles they want to participate in. Then they will be able to publish content on the author's post, edit it, add, etc., everything based on their role.

For example: the author (gym owner) publishes a listing about their gym, and registered users who want to participate in some role in their gym (trainer, animator, etc.) should also be able to influence that listing (custom post) according to the restrictions of their chosen user roles.

So, again, my problem is how to limit other users' access only to a specific post according to the selected user roles from the CRED form (every custom post has a CRED form for new users who want to participate).

Can I achieve the restriction at least on the author level using the "post groups" option you mentioned, if not on a specific post?

Is there any option with Toolset Relationships?

Author >>>>> Custom post (Listing) <<<<< Signed users with chosen user roles

#2616457

Thank you for sharing these details.

For what you're trying to achieve, the standard WordPress user roles and the Toolset's Access features won't work.

You'll need an approach where you'll be managing a parallel system of user roles and relationships:

1. All users will register on the website with a standard user role.

2. You'll add a new custom post type 'User Profiles' on the website. After registering, each user will create a new post in this post type as an author, which will serve as his/her profile post. This anchoring is needed because a relationship can be created between two post types, but not between users and the post types, directly.

3. Next, the main 'Listings' post type and the 'User Profiles' post type will need to be joined together, through a many-to-many relationship.
( ref: https://toolset.com/course-lesson/many-to-many-post-relationships/ )

This means that when a user will visit a certain listing posts page, a relationship form will be there which can be used to connect his/her 'User Profile' post with the current 'Listings' post. This connection will serve a kind of a sign up by the user for this particular listing.

4. For controlling the role of the sign up, you can include a 'Role' custom field with the intermediary post while creating a many-to-many relationship.

This way, the user will be able to select which role or capacity the user is willing to sign up or link with the current listing, while using the relationship form.

5. With the above things in place, rest of it would involve using the conditions to check whether the current user is linked to the current listing post or not and in which role, to determine what other activities can be performed by him/her with that particular listings.

I hope this makes sense and let me know if you have any follow up questions

#2618233

Yes, this is the idea, thank you so much!
I assumed it had to be solved with "relationships" to solve the problem... Since I already have a membership user profiles (different plugin), I will create a custom post "Action user subprofile" which I can then connect to the main profile and display related content (views) within the user profile page... While that subprofile will be a link to the signed listings...
I hope this will help other Toolset plugin users as well.

I'll get back in a few days...
Thanks again.

#2618305

Thanks for the update and glad that my message helped.

Let me know if you have any follow-up questions and for a new question or concern, you're welcome to start a new ticket.

#2618317

My issue is resolved now. Thank you!

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.