Is there any way to add users to a group from the back end?

Permalink
Is there any way to add users to a group from the back end?
I am setting up an IPN handler on my subscription site and I need to add a function that automatically adds users to a "subscribers" group after their payment is 'verified'.
any help??

 
12345j replied on at Permalink Reply
12345j
add en event for when the payment is verified. hook into it, and add the passed user into the group.
http://www.concrete5.org/documentation/developers/system/events...
http://www.concrete5.org/documentation/developers/permissions/users...
http://www.concrete5.org/documentation/developers/permissions/group...
something like
in the file that changes status to verified
Events::fire('on_user_verified_payment', $u);
// $u should be the user that verified the payment

in a package controller
public function on_start() {
      Events::extend('on_user_verified_payment', 'UserVerified', 'group', 'path/to/a/model/user_verified.php');
      }

in the model thats referenced in the event extend method
class UserVerified{
public function group($u){
$group = Group::getByName('name of group you want to add users to');
$u->enterGroup($group);
}
}

just a quick sketching out of the code involved.
danielboccato replied on at Permalink Reply
Thank you VERY VERY much... This is exactly what I was looking for. I am still learning php, so it will take me a while to test it out, but it should work. THANK YOU AGAIN!!!