Hi I'm trying to assign new users to a user group on a new registration based on a form field selection, I have this:
[[!Register?
&submitVar=`login-register-btn`
&activationResourceId=`211`
&activationEmailTpl=`lgnActivateEmailTpl`
&activationEmailSubject=`Thanks for Registering!`
&activationttl=`1440` &submittedResourceId=`212`
&emailField=`email`
&preHooks=`RegisterUserGroup`
&customValidators=`agreeEULA`
&usergroups=`[[+group]]`
]]
in the RegisterUserGroup snippet, I just set a hook called 'group', the group selection will show up on the page, [i.e. the hook is being passed] but the user is not added to the group on registration [i.e. the hook is not picked up by the !Register call]
What is the correct way to do this?
-thanks
-sean
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
I think you want a postHook with something like this (untested):
<?php
$user = $hook->getValue('register.user');
$user->joinGroup($hook->getValue('RegisterUserGroup'));
$user->save();