The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
We've got vbulletin pretty much integrated into our existing member portal, but I have a quick question re: username changes. When you change an existing user's username via admincp, does it simply update the username field in the user table, or is there more to it?
We have a "change username" function built-in to our existing member portal and we want to update it so that when someone wants to change their username they can just do it there without having to also request that we manually change their vbulletin username ... I know it's recommended to "update your counters" after changing a username (I assume this refers to the "Update Post Counts" function), which we can initiate programmatically, I'm just wondering if there's anything else we need to or should do besides simply updating the username in the user table? I assume everything is handled internally based on the user's ID and the username is simply for show next to their posts, etc. so I'm hoping the username isn't found in any of the other 150+ tables that I'm not familiar with. ![]() |
#2
|
||||
|
||||
![]()
I don't remember where, but i see a mod here that does this
|
#3
|
|||
|
|||
![]()
I've seen a mod that allows users to change their own username, but that's not what we want to do. We want to change the username programatically via our existing systems by simply issuing one or more mysql queries to update the necessary table(s).
|
#4
|
|||
|
|||
![]()
If you look in file includes/class_dm_user.php around line 2363, there's a function update_username() that makes changes to a number of database tables in the event that a username is changed. It's also possible to use the user datamanager (i.e. call that funciton instead of copying the code), but unless your external code is including vbulletin's global.php, it's probably more trouble than it would be worth.
|
#5
|
|||
|
|||
![]()
Thanks for the reply. Looks like it does update quite a few tables! What would you say is the "best practice" in terms of doing what we want to do? Is it better to call the change_username function, or could we simply do something like this and achieve the same thing? Or would doing this simply update the username in the user table and that's it?
... $userdm->set_existing($userinfo); $userdm->set('username', $newusername); $changeuser = $userdm->save(); And if it's better to call the update_username function, would it just be something like this?? ... $userdm->set_existing($userinfo); $userdm->update_username($userid, $newusername); $changeuser = $userdm->save(); |
#6
|
|||
|
|||
![]()
You should follow your first example. I only pointed out update_username() because I thought you might need to change the database directly instead of using the vb datamanager.
|
#7
|
|||
|
|||
![]()
We can do either, and it looks like using the datamanager will be a little simpler than re-coding 10-15 mysql queries so we'll try that route. Thanks!
|
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|