02-03-2010, 09:08 PM
|
|
|
Join Date: Oct 2007
Location: UK
Posts: 2,802
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by adamdavidconn
thanks for your support bl.
Ok, thanks for the code to add secondry usergroup, it works well. However, how do you make ti that the submitter of the form is added, rather than a numbered user. For example, you wrote
[PHP.../PHP]
I tried adding {userid} but that didnt work. That was a bad guess, its not php :P
What would you put to fetch the id of the person who filled in the form?
|
Use this:
Form Hook: Before Submit
PHP Code:
if ($complete) { $userinfo = $vbulletin->userinfo; if (empty($userinfo['membergroupids'])) { /*alter this number below*/ $user['membergroupids'] = '4'; } else { /*alter this number below, but leave the comma*/ $user['membergroupids'] .= ',4'; } $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD); $userdata->set_existing($userinfo); $userdata->set('membergroupids', $user['membergroupids']); $vbulletin->userinfo['membergroupids'] = $user['membergroupids']; $userdata->save(); }
|