Skip Navigation

[Resolved] Front end view of posts in an Access Control Posts Group

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

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 5 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1373831

I am trying to display a list of posts from a custom post type ('VFM') - there are several Post Groups, each of which has access to one or more 'VFM' posts (but never all). The access control works fine but I can't find a way of displaying only the posts that users have access to on the front end.

I'm sure this is really simple but I just can't figure it out, and all the support threads that seem related seem way more complex!

Thanks,
Phil

#1374013

Hi, Access and Views were not initially developed to be integrated this way, so the process isn't exactly straightforward. However, we recently published some new documentation that shows how you can limit access to posts in a View by enabling some hidden fields and using conditional HTML:
https://toolset.com/documentation/user-guides/using-access-to-hide-certain-posts-from-view-results/

Please review the guide and let me know if you have questions about implementing this approach.

#1374025

Hi Christian,

Thanks for getting back to me - I did see that article, but it doesn't look like what we need. That would need a separate page for each group, wouldn't it? We can train our customer's admin to add users / groups etc but setting up something conditional for each new client that they onboard is a step too far. When you add posts to the Post Group in the back end surely that's creating a relationship somewhere? Is there no way of just displaying that list to the logged-in front end user?!

Many thanks,
Phil

#1374043

That would need a separate page for each group, wouldn't it?
Not necessarily. The complexity depends on how you have organized your Users into Post Groups but it might be possible with one page, conditionals, and multiple Views. For example, let's say all Users with the role VFM-Alpha have access to one specific post group "Alpha", and all users with the role VFM-Beta have access to one specific post group "Beta". In this case you could create two Views - one for VFM-Alpha Users and one for VFM-Beta Users. In the VFM-Alpha View, you would place a conditional that tests if the current post in the loop is part of the "Alpha" post group. If so, show it. If not, skip it.

In the VFM-Beta View, you would place a conditional that tests if the current post in the loop is part of the "Beta" post group. If so, show it. If not, skip it. Now in your page or template, you can use Access Control shortcodes to display one or the other View depending on the current User's role. It becomes more complex if Users are distributed among Post Groups in a more ad hoc manner, or if Users have multiple roles.

When you add posts to the Post Group in the back end surely that's creating a relationship somewhere? Is there no way of just displaying that list to the logged-in front end user?!
The relationship between a post and its Post Group is straightforward. The relationship between Users and Post Groups is not so straightforward, so the filtering system isn't very efficient when trying to consider those connections. For now, the conditional approach is the best solution we have to this problem. I encourage you to submit your vote to integrate Access and Views results, and to make the process more straightforward. We have a suggestion form you can use here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/