Manaus Posted February 26, 2014 Share Posted February 26, 2014 Hello, I need to add the guest role to so many users I just added [using a csv] to $users pool, is there any way to make it from the backend? I'm also trying to code it, but I don't know how to make up the selector $usersWithoutRole = $users->find("roles*=gooduser,roles!*=guest, roles!=superuser") Thanks Link to comment Share on other sites More sharing options...
Pete Posted February 26, 2014 Share Posted February 26, 2014 You can write that as something like this (pipe symbol | means OR): $usersWithoutRole = $users->find("roles!=gooduser|guest|superuser"); You don't need to try and partial match if you know the exact names of the roles. If you just want to make sure every user has the guest role though, just re-add it regardless of whether they have it or not like this: foreach ($users as $u) { $u->addRole('guest'); $u->save(); } 3 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now