XF 2.3 A way to search for all posts containing <text string> posted by Anonymous?

haqzore

Active member
We migrated from phpBB to XF 2 months ago.

Before the migration, an Admin pruned some inactive users. One of those pruned users came back, and we'd like to tie their posts to their newly registered account. The posts migrated & show as Anonymous (no linked username, etc... Just a black text username).

Since this user had the habit of "signing" most of their posts (as part of the post text) with their username -- is it possible to search for all posts containing that text string + posted by Anonymous? (I can't do perform a standard search, as Anonymous isn't a valid username in the search criteria), and then merge them into the newly registered account?

Appreciate any help / ideas.
 
Last edited:
With @AndyB's help, I've located 4,489 posts we'd like to re-associate with the users new account:

1767071967761.webp

The addon above will not work, though, as we don't want to re-associate EVERY Anonymous post - only those who match both of the criteria (Anonymous + contains text).
 
The addon above will not work, though, as we don't want to re-associate EVERY Anonymous post - only those who match both of the criteria (Anonymous + contains text).
Personally I would strongly advice, if I may, against doing something like this with sql queries. This is something that is best handled through an add on in order to be done properly.

That said, you can assign posts that match certain criteria from one account to another by doing an update sql query as mentioned above by @tajhay. First of all make a backup of your entire database and you can run a sql query along these lines

SQL:
UPDATE xf_post SET user_id = x WHERE user_id = 0 AND message LIKE '%keyword%';

That will reassign all posts made by guests and match a certain keyword, to user with id of x. Adjust x and keyword accordingly in the query.

Please note that this doesn't take into account threads and should be run at one's own risk.
 
Thanks all.

My concern now is this would also flag & flip any post where anyone typed this username...

Can the search query be updated to include something like... 2 line breaks + the username?

This should differentiate the users own posts since they added a couple lines prior to their username each time (as opposed to other people mentioning the same username mid-sentence).
 
Thanks all.

My concern now is this would also flag & flip any post where anyone typed this username...

Can the search query be updated to include something like... 2 line breaks + the username?

This should differentiate the users own posts since they added a couple lines prior to their username each time (as opposed to other people mentioning the same username mid-sentence).
That can't be handled properly with raw sql queries. As per my previous post, the best way to go about this imo is through an add on which will handle all that correctly.
 
Back
Top Bottom