Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 22 Jan 2010, 06:13
razec razec is offline
 
Join Date: Nov 2009
Change primary usergroup via PHP

I'm just curious as to what the best practice is for changing a user's primary usergroup through code. I tried searching the vB4 forum here for information on it but I didn't find anything. Is there a function that handles it, or a guide that I can reference with more information?

Can I just do it with something like this? Mind you this could be completely off which is why I haven't even tried it yet.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


This is based on observations I made in register.php. I'm pretty sure it's not correct because I'm probably interpreting what's going on wrong. The point of this change is to allow the user to set what type of user they are, and in doing so this will change their primary group to match their selection. This takes place after the registration is complete, but I referred to register.php because I knew that's a place where the user's group (and other information) would be set/changed in code.

Last edited by razec; 22 Jan 2010 at 06:39.
Reply With Quote
  #2  
Old 22 Jan 2010, 12:08
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Real name: Adrian Sacchi

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #3  
Old 22 Jan 2010, 22:46
razec razec is offline
 
Join Date: Nov 2009
I get an error when this code runs:

Fatal error:

* A required field called username is missing or has an invalid value.

Unable to proceed with save while $errors array is not empty in class vB_DataManager_User in [path]/includes/class_dm.php on line 849
The code I'm using is:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

which is what I copied from your post. Any idea as to why it's throwing that error?
Reply With Quote
  #4  
Old 22 Jan 2010, 22:47
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
You should have something like this before calling set,


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Sr Software Developer / Tech Lead
Reply With Quote
  #5  
Old 23 Jan 2010, 06:06
razec razec is offline
 
Join Date: Nov 2009
Ahh, got it. That did the trick! Thank you.
Reply With Quote
  #6  
Old 29 Feb 2016, 06:52
khininger khininger is offline
 
Join Date: Aug 2009
huge thank you for this thread (idk why im not able to thank the posts directly).

i was looking for this for years. using it for the "delete my account" issues, switching them to another usergroup that hides them from members list and locks them out of forums, giving error message that they have deactivated their account, but can reactivate if they changed their mind. thank you.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 07:42.

Layout Options | Width: Wide Color: