![]() |
Custom Form User Registration
I'm trying to create a custom form for user registration and I'm stuck. I appreciate if anyone could help me out a bit. I'm not an expert coder but I try to read and put pieces together.
Here is the code that I have but it is not working. I'm not sure what I'm doing wrong here. PHP Code:
|
Not that easy!
Perhaps you need humanverification .... Look whats your $userId return. |
The human verification is disabled in the setting. Now, can someone please look at this and tell my why this is not writing the user to the database? Nothing is being saved to the database.
PHP Code:
|
If you use var_dump to dump all the variables to the screen, it might show any errors that indicate why it's not working properly.
|
Quote:
PHP Code:
PHP Code:
It looks like it is giving an error about the admin being signed in. Not sure how to fix this. Any thoughts? |
Digging into the code, a $canadminusers variable is checked to bypass most of the registration checks. More specifically, this variable holds the return value of the permission check of "canadminusers". So the admin account you're logging in as does not have a true value for the "canadminusers" permission. You should set this to true in the admincp under > Usergroups > Administrator Permissions > Edit Permissions of the admin account > set Can Administer Users to Yes.
|
Quote:
I just checked the admincp administration setting for that user and also for the usergroup (administrators) and everything is set to yes. Specifically the Can Administer Users is already YES. I actually did set it to No and tested the form and I got the same error message. I set it back to YES again. Anywhere else that you could think of? |
No, based on the code that's the only reason why it could show that error. (canadminusers permission of the user "superadmin" not set to true)
|
Quote:
I'm not sure where you are seeing the canadminusers error message? |
Quote:
There is a check for $canadminusers that allows you to bypass several registration checks. However if $canadminusers is false then it will throw an exception "signing_up_but_currently_logged_in_msg" if the user is already logged in but does not have the canadminusers permission. It's the only line of code in the entire file that throws that specific exception. |
Quote:
You are correct. The error was coming from the $canadminuser. But it was due to the setting in the user registration: Allow Multiple Registrations Per User". This was set to off. I turned it on and the magic happened. THANK YOU SO MUCH. :up: |
No problem, glad you got it working now. :)
|
Here is another question.
If I turn off "Allow New User Registrations" in the Admin CP, this script will not work. I need to make sure that my users don't register directly in the vBulletin and they go through my custom registration form. Is there a way that I could disable the user registration in vBulletin without affecting this script? |
Well again if $canadminusers variable is true then it should work because it skips that entire check. It is directly connected to "$this->hasAdminPermission('canadminusers')". If you edit that vBulletin script and add a var_dump($canadminusers); before line 2069 where the check is performed, does it show true or false? That way you can check if the admin user that is logged in is in fact allowed to alter users.
You can also assign the user the "super admin" role which you can assign in the /core/includes/config.php file in the $config['SpecialUsers']['superadmins'] variable. When it's in that variable, it will pass any kind of permission check. |
All times are GMT. The time now is 01:10 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|