Skip Navigation

[Resolved] how to filter a view by specific user role

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to filter their view by a specific user role.

Solution:

I would recommend having a look at the solution provided below.
https://toolset.com/forums/topic/how-to-filter-a-view-by-specific-user-role/#post-1208610

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 12 replies, has 2 voices.

Last updated by AmrA8547 5 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#1207475

hi team ..

i have a no programming experience ..

i need help in how to filter a view by specific user role

thank you

#1207656

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for contacting our support forum.

Not sure what you mean by filtering a view by a specific role, however you can filter a view by a specific User but not a specific role, Unless this view is listing out posts.

Please provide a little bit more clarity for me as this could also involve some nested views.

Thanks,
Shane

#1207671

ok .. i created a view that listing out pages and i want this ( Listing view ) to show only pages that created by only authors not admin

#1207715

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

So a quick follow up question to this.

Are there any users who are admins that create posts of this post type that you want to display ?

#1207716

no .. just 1 admin

#1207730

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Ok,

So right now how view works is that you wouldn't need a filter for this. It will automatically list out all the posts of users who create the post.

As you say your admin role doesn't create posts so this would mean that all other posts are created by non-admins which is what view will already list out.

Is it that a post is appearing in the view list that you don't want to appear?

#1207759

the user post is ( a page ) .. i want to create a view ( view of listing ) of users pages .. not all the site pages .

#1207890

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2019-02-28 at 1.32.03 PM.png
Screenshot 2019-02-28 at 1.22.39 PM.png

Hello,

Thank you for the clarity. This allowed me to understand exactly what you need.

On your view there should be a section with a button called Add a Filter. See screenshot

Click this button then add the filter for Post Author. Then select the option "Post author is the author of the page where this View is shown".

This should filter your view for the correct author.

Thanks,
Shane

#1207908

i think i'm not clear enough ..

i want to create view of all pages that created by all my site users that have user role "author" OR " editor" OR " subscriber "

is it possible ?

#1207924

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Not sure if I understand correctly.

You want to create a view that lists all the posts by users of Roles author, editor or subscriber.

In my initial post I mentioned that the view would list out all this by default. It will list out all the posts that are created by the users.

Your next response was "the user post is ( a page ) .. i want to create a view ( view of listing ) of users pages .. not all the site pages ."

And my previous response was that you can filter your view for the user's page that you are on.

Perhaps you need to provide me with an example so I know exactly what you are talking about.

Right now based on your last response, i'm assuming that you want a page to list out all the posts of users that are subscribers, a separate page for posts from users that are authors and finally a page for users that are editors.

Please let me know if this is what you are referring to.

Thanks,
Shane

#1207932

yes .. i want a page to list out all the posts of users that are subscribers, a separate page for posts from users that are authors

#1208610

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

So this will take some setting up to do.

First thing you need to create 3 user views. One view for each of the rolls.

Then you are going to create 3 separate pages to add each of these views. Finally in my post here https://toolset.com/forums/topic/how-to-filter-a-view-by-specific-user-role/#post-1207890 I have a screenshot of a post filter.

You are going to add this filter to the view that is listing out the posts but instead of selecting "Post author is the author of the page where this View is shown" you will select "Post author is set by the Parent User View".

Please let me know if this helps.
Thanks,
Shane

#1208751

My issue is resolved now. Thank you!