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)

Dave 07-08-2014 08:07 PM

https://members.vbulletin.com/api/vB...pdate_username

There you go. :)

Shalom. 07-08-2014 08:07 PM

Quote:

Originally Posted by tbworld (Post 2505974)
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 "class_user_dm.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.

:)

1.i can send u the code on pm..
2.i cant find this file..
3.please give me one.

tbworld 07-08-2014 08:09 PM

Update: I see in post #6, #8, this was already covered. I was on the phone so long my post is barely relevant anymore. :)

Shalom. 07-08-2014 08:12 PM

Quote:

Originally Posted by Dave (Post 2505977)

update_username (integer $userid, [string $username = null])
>
update_username ($userid, $newusername)

its good ?

tbworld 07-08-2014 08:14 PM

Send or post your code, and you have already started to use the datamanager. That is the approach you should be taking.

Dave 07-08-2014 08:14 PM

Quote:

Originally Posted by Shalom. (Post 2505980)
update_username (integer $userid, [string $username = null])
>
update_username ($userid, $newusername)

its good ?

Exactly.
Now integrate it with the piece of code you posted earlier which uses the datamanager.

Shalom. 07-08-2014 08:25 PM

Quote:

Originally Posted by Dave (Post 2505982)
Exactly.
Now integrate it with the piece of code you posted earlier which uses the datamanager.

sry, but i dont understand u :(

mokujin 07-08-2014 08:48 PM

Run this query in phpmyadmin, hope it helps:

PHP Code:

UPDATE post SET username 'New  User Name Here' WHERE userid $userid 


tbworld 07-08-2014 09:18 PM

This should work:

PHP Code:

    global $vbulletin;

    
// error processing for the datamanager if needed.
    
require_once "d:/servers/z421/web/bbs/includes/adminfunctions.php";  
 
    
// Existing User
    
$userid  6;             // Existing User ID
    
$newusername 'david1';  // New user name string (cleaned)

    
$userdata =& datamanager_init('User'$vbulletinERRTYPE_CP);
    
$userinfo fetch_userinfo($userid);
    
$userdata->set_existing($userinfo);
    
$userdata->set('username'$newusername);
    
$userdata->save();
    unset(
$userdata); 

I ran a quick test. :)

Looking at what you were doing, I am guessing you can take it from here.

Shalom. 07-08-2014 10:05 PM

Quote:

Originally Posted by tbworld (Post 2505993)
This should work:

PHP Code:

    global $vbulletin;

    
// error processing for the datamanager if needed.
    
require_once "d:/servers/z421/web/bbs/includes/adminfunctions.php";  
 
    
// Existing User
    
$userid  6;             // Existing User ID
    
$newusername 'david1';  // New user name string (cleaned)

    
$userdata =& datamanager_init('User'$vbulletinERRTYPE_CP);
    
$userinfo fetch_userinfo($userid);
    
$userdata->set_existing($userinfo);
    
$userdata->set('username'$newusername);
    
$userdata->save();
    unset(
$userdata); 

I ran a quick test. :)

Looking at what you were doing, I am guessing you can take it from here.

thanks, it work's !


All times are GMT. The time now is 02:25 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
  • Page Generation 0.01053 seconds
  • Memory Usage 1,751KB
  • 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
  • (3)bbcode_php_printable
  • (5)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