Place register members into groups after registrations.

Permalink 1 user found helpful
After a customer or anyone else register at my website, I want them to automatically place in a group called customer. Is this possible, anyone know?

Thanks

View Replies:
jordanlev replied on at Permalink Reply
jordanlev
This should be possible using events. See this page for general instructions:
http://concrete5.org/help/building_with_concrete5/developers/mvc/ev...

The example in that documentation is actually pretty close to what you want, except you'd want to name your event differently than "setupUserJoinInfo" -- something like "placeNewUserInGroup" -- then the code you'd put in your ApplicationUser class would be something like this:
class ApplicationUser {
    public function placeNewUserInGroup($u) {
        $g = Group::getByName('Name of the group you want new users to be put into');
        $u->enterGroup($g);
    }
}


Hope that helps!

-Jordan
luan replied on at Permalink Reply
Thank you, I'll give this a try.

Best.
linewave replied on at Permalink Reply
Hi,I also need the event.
I tried putting the code in there.
but New user can't be into groups..

Did you succeed?
luan replied on at Permalink Reply
I haven't gotten it to work yet. But I haven't really had a lot of time to try it out. I will let you know if I am successful.
linewave replied on at Permalink Reply
Thank you for reply.
I try putting it again, I will report it.


If somebody has the information about this, please teach it
bio replied on at Permalink Reply
In the documentation it states:

Add the following to your config/site.php file.

define('ENABLE_APPLICATION_EVENTS', true);
*NOTE: the above code is only need for concrete5 versions less than 5.4

I am running version 5.4.1.1 and i DID have to add this code to my site.php to get it to run. Didn't work without it.
jordanlev replied on at Permalink Reply
jordanlev
Seehttp://www.concrete5.org/community/forums/customizing_c5/place-new-...

EDIT: Better yet, I put up a free addon to do this which is now available in the marketplace:
http://www.concrete5.org/marketplace/addons/registrant-group/...