yesjoar Posted November 24, 2012 Share Posted November 24, 2012 Hi there, is it possible to became all backend users in the frontend? $user worked only for the current user. I thought there is something like $page and $pages. When I try var_dump($user) and var_dump($users) I became different results, but in both results there are not the other users. I think there is no function for that yet, but is it possible to get acces on a other way? I need a way to change some fields of a special user in the frontend. y. Link to comment Share on other sites More sharing options...
Soma Posted November 24, 2012 Share Posted November 24, 2012 Its $users like $pages. Forget var dump:-) Also the cheatsheet is your friend ;-) http://processwire.com/api/cheatsheet/ 3 Link to comment Share on other sites More sharing options...
yesjoar Posted November 24, 2012 Author Share Posted November 24, 2012 Oh man, I forgot the cheatsheet. Thanks! I only looked into the API section and there is no $users. Link to comment Share on other sites More sharing options...
Soma Posted November 24, 2012 Share Posted November 24, 2012 Because they're pages. so same applies. And it's there.. http://processwire.com/api/cheatsheet/?filter=users Link to comment Share on other sites More sharing options...
yesjoar Posted November 24, 2012 Author Share Posted November 24, 2012 Okay, now i display all users with a special content in given field. That works fine for me. But when I want to change the role of each user i've found. $allusers = $users->find("field=xyz"); foreach($allusers as $u){ $u->removeRole('oldrole'); $u->addRole('newrole'); $u->save(); } But $u is a valid user object, or not? Link to comment Share on other sites More sharing options...
Soma Posted November 24, 2012 Share Posted November 24, 2012 What is the error? Possibly u need to turn off output formatting for the user before manipulating. $u->of(false). 1 Link to comment Share on other sites More sharing options...
yesjoar Posted November 24, 2012 Author Share Posted November 24, 2012 Perfect, now it works. (: 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