Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2014, 07:38 PM
Shalom. Shalom. is offline
 
Join Date: Jun 2014
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 07-08-2014, 07:42 PM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://vborg.vbsupport.ru/showthread.php?t=236980&highlight=change+username" target="_blank">https://vborg.vbsupport.ru/showt...hange+username</a>
Reply With Quote
Благодарность от:
tbworld
  #3  
Old 07-08-2014, 07:45 PM
Shalom. Shalom. is offline
 
Join Date: Jun 2014
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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..
Reply With Quote
  #4  
Old 07-08-2014, 07:50 PM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the above plugin will do it for you
Reply With Quote
  #5  
Old 07-08-2014, 07:51 PM
Shalom. Shalom. is offline
 
Join Date: Jun 2014
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i dont want plugin..
i have the all code, i just want code to update the username in all tables(on db)
Reply With Quote
  #6  
Old 07-08-2014, 07:53 PM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then why don't you download that plugin and see how it works
Reply With Quote
  #7  
Old 07-08-2014, 07:55 PM
Shalom. Shalom. is offline
 
Join Date: Jun 2014
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #8  
Old 07-08-2014, 07:58 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 07-08-2014, 08:00 PM
Shalom. Shalom. is offline
 
Join Date: Jun 2014
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dave View Post
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
Reply With Quote
  #10  
Old 07-08-2014, 08:05 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Shalom. View Post
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.

Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 08:40 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07319 seconds
  • Memory Usage 2,253KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete