Skip Navigation

[Resolved] Access permissions, read own posts but not others

This support ticket is created 5 years 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)

This topic contains 4 replies, has 3 voices.

Last updated by sarahK-2 4 years, 12 months ago.

Assisted by: Nigel.

Author
Posts
#1485937

I have a User type called "Team LEADERS". These are not Admin Users, and do not have a dashboard.

I have a Post Type called "Message to the Team Leaders".

The form to create new Messages to the Team Leaders is available to all Users who are "Team MEMBERS".

I need all Team Leaders to be able to see the Messages to the Team Leaders. I have this set up and working fine. I have created a view for the Team Leaders that only they can see. It lists all Messages to the Team Leaders from all Team Members. They are able to click on and view each Message (single post) and to comment on/reply to it. Each User whose User status is Team Leader can do this.

I need each Team MEMBER to be able to see only his or her own post. They should be able to communicate back and forth, via comments on the post, with the Team LEADERS. But, the Team MEMBERS must not be able to see the posts of others (including by URL).

I am finding that I can allow the Team Members to see ALL or NONE of the Messages post type. I am able to create a view that lists only their own posts, visibility of the posts of others via url is still a problem. I have played around with the settings quite a bit, but am just not getting it to do what I need.

Thanks in advance!

#1486153

You can create a view of Message posts and set it so to query only those posts whos author is the current logged in user.

This can be done in the Views Query Filter settings when creating or editing the View in question.

This would then show only those posts the user actually authored.
If you want to do this via URL parameter you'd have to set that query to listen to a URL parameter, and then pass that URL parameter somehow to the page where the View is inserted to.
But since the Member, as logged in user, will always only see his own posts if you set an author filter directly comparing the logged-in user, this should be superfluous.

Let me know if this helps

#1486381

I already have the views working the way I need. My problem is that I am concerned about team members getting access to posts other than their own directly via the url. I think I need Access to do this.

I want Team Leaders to be able to see all, and comment on, Team Member posts (of this type) - and Team Members to only see, and comment on, their own - including via url.

Thanks again!

#1486733

Nigel
Supporter

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

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

There isn't such a setting that distinguishes read rights by role depending on whether you are the author of the post or not.

What you can do is to edit the template for these posts and then wrap the whole content inside a conditional shortcode which checks whether the post author is the logged-in user.

https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/

There is a risk then that if the post content were long you would run into this issue: https://toolset.com/errata/shortcodes-in-conditionally-displayed-content-may-not-be-executed-on-the-front-end/

#1504609

As usual, great support. Thanks!