XF 1.2 Help creating a Query

Stormlilly

Member
Hey guys,

I would really appreciate it if one of you talented XF folks could help me out with a Query I need.

When I used to run my forum on Vbulletin this is the SQL Query I would run to update a user's name throughout posts.

UPDATE `post`
SET `pagetext` = REPLACE(`pagetext`, 'membername1', 'membername2')

I'm looking for something similar for XF, because the table structures are different I need a little help.
 
I believe it is much easier with XenForo.

You should be able to edit their username within the Admin Control Panel, and then it just updates the username throughout posts automatically.

Am I correctly following what you want to do?
 
oman is correct in what he says. Updating the username in the Admin CP will indeed update all of the tables everywhere, but not within post content.

So if I'm understanding the original query correctly you are looking for a way to update mentions of the old username to the new username. This would presumably be useful for updating posts which have quoted the user, etc.

If that is the case then the query to run isn't too dissimilar.

Code:
UPDATE `xf_post`
SET `message` = REPLACE(`message`, 'membername1', 'membername2')
 
Hey Oman,

Thank you for replying.

Do you know if it changes the instance of the username when it has been quoted by other users in conversations?

I have updated the username manually, I just presumed that it wouldn't include changing it in post text..
 
Hey Oman,

Thank you for replying.

Do you know if it changes the instance of the username when it has been quoted by other users in conversations?

I have updated the username manually, I just presumed that it wouldn't include changing it in post text..

Not sure. Never specifically have tried it before. @Brogan might be able to confirm for you.
 
Back
Top Bottom