The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
|||
|
|||
It's not needed as far as I can see. Now regarding the username... I'm not entirely sure but it seems that the username is not updated by making use of the save method in the user API. Not sure at the moment how that can be done.
|
#12
|
|||
|
|||
Interesting. After you said that, I went back and looked at the default profile edit page. It looks like vB does not give the option to users to change their username either. So, probably that's why we can't use this api to change the user's name. I guess I need to follow the same process and not allow users change their usernames.
So in that case and for my knowledge, why do we need the following line in the save user api? PHP Code:
PHP Code:
OK, now I think I'm losing my mind. This is crazy. When I tested the script I posted here 10 minutes ago, it was working by updating the user's email and password, and when I was entering a wrong password, it was giving me the error message "badpassword". Now I went back to test again (without changing anything in the code) and I'm getting the error message "enter_current_password" error message, even when I enter correct current password or wrong currect password and nothing is updating. How in the world is this possible that I'm getting a different response? |
#13
|
|||
|
|||
Finally, I was able to put everything together and make this thing work. Thank you both for all your help.
Now. I have one issue/question. The following line is updating the username: PHP Code:
Is there any instruction on how to search the vB database to search for data? Can you help? |
#14
|
||||
|
||||
You should not use "vB::getDbAssertor()->update" because this is a direct database action. There are api-functions for that.
|
#15
|
|||
|
|||
Quote:
I managed to figure out how to search the database to prevent duplicate username entry by using vB::getDbAssertor()->getRow. What is the API that I could use instead of vB::getDbAssertor()->update which will be more secure? Can you please advise? Is it ok to use vB::getDbAssertor()->getRow in an if statement to search for the data? Thank you again. |
#16
|
|||
|
|||
Quote:
But a forum is a complex build with some particularly important elements (e.g. users with conventions for name length or password security). If you edit this directly you have to implement the same logic (checks, validations, needed following changes in other tables or cache refresh ...) in your code. So you should use exposed api calls who implement the logic for you. As a starting point http://vb5support.com/resources/api/ and for this case http://vb5support.com/resources/api/..._checkUsername. I haven't done such a user update so I can't give you code. But I would go this way or start there. And http://vb5support.com/resources/api/...ml#method_save could be useful for final update. And as a general note - if you find a possible useful api call (the description sounds good) and find no examples for that (parameters, more lines example) use the vB source code. A search for checkUsername shows 5 relevant code lines \forum\core\vb\api\user.php 5600,18: public function checkUsername($candidate) \forum\core\vb\api\vb4\register.php 67,38: $check = vB_Api::instance('user')->checkUsername($username); \forum\includes\vb5\frontend\controller\registrati on.php 285,24: public function actionCheckUsername() 297,36: $result = $api->callApi('user', 'checkUsername', array('candidate' => $_REQUEST['username'])); \forum\js\signup.js 11,2351: ... First is api implementation, last I think not relevant here. But the others - try to unterstand the methods and the logic there |
#17
|
|||
|
|||
shka,
Thank you for your helpful post. I am just starting to use vBulletin and I'm gathering as much information as I can, so your comments are much appreciated. I checked the cherusername api and I will be using it in my code. However, the user save method, is not updating the username, that's why I'm using the database update. When I checked the default profile edit page on vB, there is no option for users to change their username. So I think vB by default, doesn't allow this (except from the AdminCP) and therefore the save function doesn't updat the username. Unless I'm missing something. |
#18
|
|||
|
|||
<a href="http://vb5support.com/resources/api/vB_DataManager_User.html" target="_blank">http://vb5support.com/resources/api/...ager_User.html</a> with update_username and verify_username ?
|
#19
|
||||
|
||||
As Wayne mentioned anywhere you should use the mobile-API including an API-Key!
API=> user -> saveEmailPassword For security reasons you should not use your scripts on any live forum. Not that I will say it is unsafe, but changing an email by give users the ability to write anything to the user->email field (even non email-strings) is not the best idea! |
Благодарность от: | ||
In Omnibus |
#20
|
||||
|
||||
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|