The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Custom Profile Update
Hi,
I'm trying to make a custom form for users to update their profile. I have the following code, which I thought it should work. PHP Code:
Your submission could not be processed because a security token was missing. If this occurred unexpectedly, please inform the administrator and describe the action you performed before you received this error. And I see the following error at the top of the page: Notice: Undefined index: usefiles in /home/myserver/mysite.com/forum/includes/vb5/template/stylesheet.php on line 70 Notice: Undefined index: usefiles in /home/myserver/mysite.com/forum/includes/vb5/template/stylesheet.php on line 70 I appreciate if someone could help me with fixing this code. Thanks |
#2
|
|||
|
|||
I made some progress, but the code is still not working correctly.
Here is what I have: PHP Code:
1- It is not updating the email address 2- You can enter wrong current password and it still runs without throwing an error. 3- Can I update the user email, password and username without the need to enter the current user? I appreciate anyone that could help with this. |
#3
|
|||
|
|||
You must pass 'acnt_settings' => true to the 'extra' array. Based on the code that allows you to edit the email/password as a regular user and also includes current password verification.
You need to extract the userid from the current session returned by vBulletin and not from a cookie because I can just simply use a cookie editor to edit my bbuserid cookie to the userid of an administrator and then hijack the account. |
#4
|
||||
|
||||
Quote:
|
#5
|
|||
|
|||
Thank you both for your valuable feedback. I'm not a programmer and I had someone do this for me. That's why I shared it here to make sure we are doing things correctly and improve it.
I really appreciate your advice. |
#6
|
|||
|
|||
After reading the vB API documentation, it looks like the acnt_setting should be set to 1.
So, I changed the code as you advised and I'm getting the userid from vB fetchUserinfo instead of cookies. However, my code still not working. It is not updating the username. Also it is not verifying the current password. What am I missing? PHP Code:
|
#7
|
|||
|
|||
var_dump($response); to see what that is showing. If nothing happens, dump the variables one by one to make sure everything is still working as expected.
|
#8
|
|||
|
|||
Thank you Dave.
It appeared that actually my code worked (partially). When I enter the wrong current password, it doesn't update anything, appropriately. But It is not showing any errors to the user. the var_dump($response); showed the following: PHP Code:
The other problem is that even when I enter the correct current password, it only updates the email and password and DOES NOT update the username. I'm not sure why. |
#9
|
|||
|
|||
Does the new password save properly? You might have to set the 'password' key to the new password in the array.
As for showing errors, just iterate over the errors array if it's set. Something like PHP Code:
|
#10
|
|||
|
|||
Dave,
Thanks again for your reply. That took care of the error message. Great. The password is updating appropriately. However, the username is still not saving at all. Any idea why? Also, I noticed just now that the last line is actually not needed. I ran the code without the vB::getDbAssertor and it is working exactly the same. Do you know if I need this line? PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|