← Back to Passage Permission and Roles System Support
This might seems a little bit off but i have been trying to wrap my head around permission, roles and groups. I am new to octobercms and learning by practice and i find your plugin easy to grasp. I have two groups and two registration forms meant for these two groups, One for sellers and the other for buyers. I want users to be automatically added to groups on registration. I little digging around and i learnt i should create a new plugin and add this in the boot method
use Rainlab\User\Models\UserGroup
use Event;
public function boot()
{
Event::listen('rainlab.user.register', function($user){
$group =
UserGroup::where('code', 'seller-account')->first();
$user->groups()->add($groups);
$user->save();
});
Event::listen('rainlab.user.register', function($user){
$group =
UserGroup::where('code', 'buyer-account')->first();
$user->groups()->add($groups);
$user->save();
});
}
That doesn't seem to do anything and i dont know how it connect to the forms. If you have had to deal with something similar. I will really appreciate your help on this.
Last updated
1-2 of 2