vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Change username on custom php page. (https://vborg.vbsupport.ru/showthread.php?t=312831)

Shalom. 07-08-2014 07:38 PM

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.

ForceHSS 07-08-2014 07:42 PM

<a href="https://vborg.vbsupport.ru/showthread.php?t=236980&highlight=change+username" target="_blank">https://vborg.vbsupport.ru/showt...hange+username</a>

Shalom. 07-08-2014 07:45 PM

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..

ForceHSS 07-08-2014 07:50 PM

the above plugin will do it for you

Shalom. 07-08-2014 07:51 PM

i dont want plugin..
i have the all code, i just want code to update the username in all tables(on db)

ForceHSS 07-08-2014 07:53 PM

Then why don't you download that plugin and see how it works

Shalom. 07-08-2014 07:55 PM

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?

Dave 07-08-2014 07:58 PM

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.

Shalom. 07-08-2014 08:00 PM

Quote:

Originally Posted by Dave (Post 2505970)
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.

so how in the admincp it's change the all username in all tables?
can u give me the code from the admincp ? i can't find it :(

tbworld 07-08-2014 08:05 PM

Quote:

Originally Posted by Shalom. (Post 2505961)
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.

First, it would have been nice if you showed your code, when your asking for assistance time.
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.

:)


All times are GMT. The time now is 07:23 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00992 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete