Jump to content

Why is check_access necessary filtering user roles?


suntrop
 Share

Recommended Posts

I am wondering why I need to add check_access to filter user roles

// $page->members is a Page reference field to users
$members = $page->members('roles=staff, check_access=0'); // output: 4 (for none superusers)

$members = $page->members('roles=staff'); // output: 0 (for none superusers, but 4 for superusers)

 The members field is just a list of people belonging to a certain group. The group is split into users with the role 'staff' and those with just a 'member' role. I want to get only those with the staff role (and later those without that role).

Link to comment
Share on other sites

I guess that's because users are pages under admin, so If a user with "guest" role (which is the default for every request made to the site) runs that code, it won't normally have access to that data, unles specified with check_access selector. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...