The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
DataManager: Problem changing username before deleting user
Hello,
We want to change the username of all users we delete prior to their deletion so that all their "Guest" posts contain the new username. We have the DataManager code for both changing the username and deleting a user, and each works fine independently. The change username code correctly changes the username of the user and the change is correctly reflected in all of that user's posts and threads. Likewise, the delete user completely deletes the user and changes all the user's posts to the "Guest" title. However, when run together, one right after the other, they cause a problem. The code below does NOT change the username of all the posts of the user, even though it does change the user's username and then deletes him, leaving all his posts with his original username (not the new username): PHP Code:
Both $changeuser and $deleteuser return 1, so they are executing correctly. However, as mentioned above, when the script is done deleting the user, all his deleted posts contain the original username, not the new username changed in the script. However, if we split the code above into two separate scripts (one to change the username and the other to delete the user), and run one after the other, then it works and correctly changes the username of all the user's posts such that after he is deleted, it displays the new username in all his posts (together with the "Guest" title). This tells us that when it is run together, something either in the SESSION vars or some GLOBAL var is not being updated with the new username, so that when the delete part comes along, it still has the old username in memory and that's why it is not changing the username in the posts (or something to that effect). (We should add that it DOES change the username in the threads, but NOT the posts, which is very strange.) So how can we resolve this so we don't have to run it as 2 scripts? Is there some way of "refreshing" whatever variable might be causing this? Thanks! |
#2
|
|||
|
|||
I think it might be that fetch_userinfo() reads cached information, so you could try this before the delete call:
Code:
$userinfo = fetch_userinfo($userid, 0, 0, 1); // the 4th parameter is "nocache" |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|