The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Automatic Account creation Error Handling & Usergroup Updating
Hi,
Thanks for the great support and codes. I have this code from another thread which is working great adding new account automatically. PHP Code:
I just stuck with error handling.. i.e. there could be two types of errors.. 1. Email is already in use.. that means this user is already registered ! in that case i want to add him to additional usergroup 2. Username already exists... but Email does not in use, that means user need to choose some other USERNAME, in that take to form again to ask to choose different username.. I am stuck on #1 above.. as in errors $newuser->errors how can i make sure that if $newuser->errors[0] is error case #1 or #2 $newuser->errors[1] is error case #1 or #2 Ideally it would be great if i could have $newuser->errors['email'] that means email already exists but not username, error case #1 above. $newuser->errors['username'] that means username already exists error case #2 above. Maybe i am approaching it wrong, i am very new to VBulletin.. hope you can guide me Thanks |
#2
|
|||
|
|||
Unfortunately, the datamanager errors are designed to be displayed and not checked via a program, so the only thing you could really do is check each string in the error array against what you know the error message should be (or else just display all the error strings instead of trying to sort it out).
You could call $newuser->set('username', $username) then check $newuser->errors[] for an error, but there are actually a number of error sthat can happen from setting a name so you don't know for sure that it's "name already in use". (See includes/class_dm_user.php, function verify_username() around line 377). |
#3
|
|||
|
|||
Hi Kevin,
Thank you very much for your support. You really have given me good points to lead this towards a possible solution. Your tip of checking each string in the error array for possible error types could be awesome. Thank you! |
#4
|
|||
|
|||
Hi Kevin,
Hope you can help with this one step.. With your idea i was able to handle errors and determine which the cause maybe.. I just stuck at last step..that when i know that user account already exist, how can i upgrade the user to add him to another usergroup.. PHP Code:
i mean the 2nd last line in above code.. i am unsure of exact syntax of the VB/php code here. Any help in this regard is appreciated. Thanks! |
#5
|
||||
|
||||
The line you want to work use is:
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|