Skip Navigation

[Resolved] how to automatically limit access to new posts to certain user role/group

This support ticket is created 6 years, 6 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Author
Posts
#695632

I want to assign a custom post type to one user and have every new post automatically being restricted for all other users.

I know I can do this in every individual post, but is there a way to limit access beforehand? I hope I made myself clear.

#695634

Extra info: I want the user to be able to add new posts with a cred form and do not give him the possibility to use the back end.

#696064

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

Access rules are based on roles, rather than individual users.

So a particular role can have particular rights to an entire custom post type, or you can create groups of individual posts to define rights to that group, but, again, based upon the user role.

You can restrict access for individual users with conditional shortcodes, typically so that the currently logged-in user would only see their own content, for example, although you could make it so that only a specific user could see certain content.

Conditional shortcodes are described here: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

If I understand your question correctly, you want one user to be able to submit posts of a certain type via CRED, and only that user, is that correct?

Because for that you can hide/display the CRED form conditionally, e.g.

[wpv-conditional if="( '[wpv-user field="ID"]' eq '2' )"]
...CRED form here...
[/wpv-conditional]

[wpv-conditional if="( '[wpv-user field="ID"]' ne '2' )"]
...alternative content here...
[/wpv-conditional]

Is that what you had in mind?

#696303

Hi Nigel,

Thank you for your answer. I was not very clear in my explanation I think. I want one custom post type with all its posts only accessible by one user (and the admin), and also the new posts that will be made (on the front end with a cred form) assigned automatically to that user (role). Now I have to go into the post and click in the upper right corner which user groups it belongs to, to assign it to that user group (of one user in this case). That is what I would liker to avoid.

#696982

Your answer pushed me in the right direction.

Thanks. Have a nice weekend.