verdeandrea Posted April 29, 2016 Share Posted April 29, 2016 Hi, I've followed this post https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-templates-or-parents-for-users%C2'> I've created a new template and a new parent page for some kind of user. Everything is working fine, but i would like to have a default role for this kind of user when a new one is created, so the site administrator doesn't have to change it (...and probably mess with it....). Is it possible? Thanks Link to comment Share on other sites More sharing options...
LostKobrakai Posted April 29, 2016 Share Posted April 29, 2016 Hook into Users::added and add the role to those users there. 1 Link to comment Share on other sites More sharing options...
mr.mc.mauser Posted March 25, 2017 Share Posted March 25, 2017 hi, how this works ? Quote Hook into Users::added and add the role to those users there. if i try this: $this->addHookAfter('Users::added', function($event) { wire(log)->save('test', 'Neuer User'); // some code }); it dosent work nothing in my test.txt, but this works: $this->addHookAfter('Pages::added', function($event) { wire(log)->save('test', 'Neue Seite'); $pages = $event->arguments(0); if ($pages->template == 'user'){ $u = wire(users)->get($pages->id); $u->addRole('member'); $u->language = wire(languages)->get('deutsch'); $u->save(); } }); what ist the way to Hook into Users::added ?? Link to comment Share on other sites More sharing options...
adrian Posted March 25, 2017 Share Posted March 25, 2017 There is no Users::added hook. Since users are pages, what you are doing looks to be the correct option. 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