Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-25-2011, 05:29 PM
redraider redraider is offline
 
Join Date: Sep 2006
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Programmatically adding a secondary usergroup to a user

I am using google checkout outside the vbulletin system. After user pays, I want to add him to the "paid members" usergroup (as a secondary usergroup) to vBulletin. How can I achieve this programatically? As a result of this addition the customer would have some additional access as per the "paid members" permissions.

Please guide.
Reply With Quote
  #2  
Old 03-27-2011, 06:07 PM
Yellow Slider Yellow Slider is offline
 
Join Date: Aug 2006
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can do something like this:
PHP Code:
$paid_members_ugid = 10;
$userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$userdm->set_existing($userinfo);
$userdata->set('membergroupids', ($userinfo['membergroupids'] ? implode(", ", array_push(explode(", ", $userinfo['membergroupids']), $paid_members_ugid)) : $paid_members_ugid));
$userdm->save; 
Haven't tested it, but it's supposed to work.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:56 PM.


Powered by vBulletin® Version 3.9.0
Copyright ©2000 - 2017, vBulletin Solutions Inc.