This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

corymillz40435183
corymillz40435183

I am working on a project that has two registration forms with group codes seller-account and buyer-account and i want users to be automatically assigned to these groups on registration. I created a new plugin and have this in my boot method

use Event Event::listen('rainlab.user.activate', function ($user) { $group = \RainLab\User\Models\UserGroup::where('code', 'seller-account')->first(); $user->groups()->add($group); $user->save(); });

Event::listen('rainlab.user.activate', function ($user) { $group = \RainLab\User\Models\UserGroup::where('code', 'buyer-account')->first(); $user->groups()->add($group); $user->save(); });

Question is how do the different forms know which group its entry belongs to? Do i change the paramCode to the group code? because that does seem to work

Last updated

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.