Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 17 Aug 2019, 18:41
doc55 doc55 is offline
 
Join Date: Aug 2019
Question 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.


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

Reply With Quote
  #2  
Old 19 Aug 2019, 11:37
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Not that easy!

Perhaps you need humanverification .... Look whats your $userId return.
__________________
vBulletin-Forum.de closed!
Reply With Quote
  #3  
Old 20 Aug 2019, 18:48
doc55 doc55 is offline
 
Join Date: Aug 2019
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.

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

Reply With Quote
  #4  
Old 20 Aug 2019, 19:30
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
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.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #5  
Old 20 Aug 2019, 21:00
doc55 doc55 is offline
 
Join Date: Aug 2019
Originally Posted by Dave View Post
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.
Thank you for your reply. Here is the result for var_dump($data);


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

Result of var_dump($response):

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


It looks like it is giving an error about the admin being signed in. Not sure how to fix this.
Any thoughts?

Last edited by doc55; 20 Aug 2019 at 21:07.
Reply With Quote
  #6  
Old 20 Aug 2019, 21:18
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
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.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #7  
Old 20 Aug 2019, 21:33
doc55 doc55 is offline
 
Join Date: Aug 2019
Originally Posted by Dave View Post
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.
Thanks again for your follow up.
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?

Last edited by doc55; 20 Aug 2019 at 21:54.
Reply With Quote
  #8  
Old 20 Aug 2019, 21:54
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
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)
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #9  
Old 20 Aug 2019, 21:56
doc55 doc55 is offline
 
Join Date: Aug 2019
Originally Posted by Dave View Post
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)
But the error message is actually reading "signing_up_but_currently_logged_in_msg".
I'm not sure where you are seeing the canadminusers error message?
Reply With Quote
  #10  
Old 20 Aug 2019, 21:59
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
Originally Posted by doc55 View Post
But the error message is actually reading "signing_up_but_currently_logged_in_msg".
I'm not sure where you are seeing the canadminusers error message?
Check the file /core/vb/api/user.php line 1999, 2069 and 2083 and you'll see what I'm talking about.

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.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #11  
Old 20 Aug 2019, 22:47
doc55 doc55 is offline
 
Join Date: Aug 2019
Originally Posted by Dave View Post
Check the file /core/vb/api/user.php line 1999, 2069 and 2083 and you'll see what I'm talking about.
OMG!!!!!!!!!!!!!! Your observation was the best help.
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.
Reply With Quote
  #12  
Old 20 Aug 2019, 22:54
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
No problem, glad you got it working now.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #13  
Old 20 Aug 2019, 23:08
doc55 doc55 is offline
 
Join Date: Aug 2019
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?
Reply With Quote
  #14  
Old 20 Aug 2019, 23:16
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
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.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
Reply


Tags
custom form, registration


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 21:01.

Layout Options | Width: Wide Color: