Quote from: donshakespeare at Jan 19, 2013, 09:45 AMBut can the &usergroupsField property be manipulated somehow so that the user sees the groups as options from which to choose?
If this is possible, then it'll probably beat any other method.
So instead of having multiple register calls with specified usergroups attached, a single call is made with drop-down or check-box options.
That's the purpose.
Quote from: donshakespeare at Jan 19, 2013, 09:45 AM
Also, anyone know if the above posthook and
<select name="product" id="product">
<option value="Usergroup1" [[!+product:formitisselected="`Usergroup1`]]">Usergroup1</option>
<option value="Usergroup2" [[!+product:formitisselected="`Usergroup2`]]">Usergroup2</option>
<option value="Usergroup3" [[!+product:formitisselected="`Usergroup3`]]">Usergroup3</option>
</select>
will work in UpdateProfile, so that a user may change or add self to another group at will?
No, it's only for registration.
For UpdateProfile, in its hook, just reload the user's attribute on-the-fly like this.
$userObj = $modx->getObject('modUser', $userId); // please provide $userId
/* create membership */
/** @var modUserGroupMember $member */
$member = $modx->newObject('modUserGroupMember');
$member->set('member', 0);
$member->set('user_group', $usergroupId); // please provide $usergroupId
$member->set('role', 1);
$userObj->addMany($member, 'UserGroupMembers');
$userObj->save();
$modx->user->loadAttributes(array(), 'web', true); // usergroups reloaded
@BobRay,
lol.
What I did was also for a badly hacked SubscribeMe.