![]() |
Change username on custom php page.
hello, i just make a new php page that allowed users to change their usernames.
i use this code: $db->query_read("UPDATE user SET username='$newusername' where userid=$userid"); but it's sucks because in the fromdisplay i still see the old username. i tried to find the code that used on the admincp but i didn't find it.. please help, thanks. |
<a href="https://vborg.vbsupport.ru/showthread.php?t=236980&highlight=change+username" target="_blank">https://vborg.vbsupport.ru/showt...hange+username</a>
|
i have a custom page..
i just want the code to set the new username. i try this code: $db->query_read("UPDATE user SET username='$newusername' where userid=$userid"); but in the forumdisply i still have the old username (i tried to find the code from the admincp>user.php but i didn't find the code.. |
the above plugin will do it for you
|
i dont want plugin..
i have the all code, i just want code to update the username in all tables(on db) |
Then why don't you download that plugin and see how it works
|
i did..
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_CP); $userdata->set_existing(fetch_userinfo($exists['userid'])); $userdata->set('username', $vbulletin->GPC['newusername']); $userdata->save(); unset($userdata); but it dosent work.. maybe i have mistake ? can u give me expamle with that code? |
It shows the old username because in the post table there's a column called username and in the thread table there are 2 columns called postusername and lastposter.
|
Quote:
can u give me the code from the admincp ? i can't find it :( |
Quote:
Second, where is your query_write? Third, use the datamanager you will have less problems. See "/includes/class_dm_user.php". There are several examples here on the board on how to use the datamanagers. I will see if I can find you a reference. :) |
|
Quote:
2.i cant find this file.. 3.please give me one. |
Update: I see in post #6, #8, this was already covered. I was on the phone so long my post is barely relevant anymore. :)
|
Quote:
> update_username ($userid, $newusername) its good ? |
Send or post your code, and you have already started to use the datamanager. That is the approach you should be taking.
|
Quote:
Now integrate it with the piece of code you posted earlier which uses the datamanager. |
Quote:
|
Run this query in phpmyadmin, hope it helps:
PHP Code:
|
This should work:
PHP Code:
Looking at what you were doing, I am guessing you can take it from here. |
Quote:
|
Glad to hear :)
Please, thank all the other gracious volunteers in your thread that gave you a hand, they don't ask for much. Personally, I prefer a beer.:) |
thanks all, have a good night <3
|
All times are GMT. The time now is 06:37 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:
|