Eltom Posted August 19, 2013 Share Posted August 19, 2013 Hi all, as I understand the users concept in processwire, every user is a page with a template "user", right? So a foreach($pages->find("template=user, include=all") as $myuser) { ... } will cycle through all the users on my system ( I already did that, seems to work). Now I want to edit a specific user. In my understanding a $myuser = $pages->find("template=user,name=$someusername); $myuser = $pages->find("template=user,id=$someuserid); .... gets a single user, but this seems wrong. I'd love to get a specific user object to edit (name, password etc.) it and save it, but I don't know how to access it. Regards, Thomas Link to comment Share on other sites More sharing options...
Wanze Posted August 19, 2013 Share Posted August 19, 2013 Hi Eltom, Using $pages->find() will always return a PageArray. To get a single page, use $pages->get(). For users, there's also the $users API variable available: $u = $users->get('username'); // Search by Username, ID or Selector $u = $users->find('selector'); // Search multiple users by Selector But specifing the user template as you did above is also fine, I guess 1 Link to comment Share on other sites More sharing options...
Eltom Posted August 20, 2013 Author Share Posted August 20, 2013 Thanks, Wanze. Finally I found $users..... I always checked on $user and there was no find() or get(), which is logical, because it's "my own user object". @all: Thank you for all the help I received regarding Users and Pages in this and other Threads! With your help I was able to implement some nice User-Management for my client! *THUMBSUP* 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