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

haqzore

Active member
Licensed customer
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).
 
With @AndyB's help, I've located 4,489 posts we'd like to re-associate with the users new account:

View attachment 331804

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).
Modify the sql to update the user_id to the newly registered account. Rebuild. Boom.
 
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.
 
Hi all - we have been chipping away at this a little over time, manually re-assigning posts bit by bit.

A new question / issue, though. When I use the standard Search > text.string (since the user always "signed" their posts with their username), it returns the max 10 pages of results.

How do I get all results without stopping at the 10th page?
 
watch out for quotes too. anyone who quoted will get the string in there and that is not the intent to update that post as the owner (assuming another guest or deleted user quoted)

The max page bug has been fixed, but not yet released
https://xenforo.com/community/threads/show-older-items-is-missing-since-update.235474/


This is a great exercise for ai.

List all postIDs from this website that contain the text "string"

and then you can query that list with an IN(1,2,3,9999) query.
validate, and then tun an update based on post ID, not a like statement.


1772723317480.webp
1772723333306.webp


explore a bit on your site :)
 
Hi all - we have been chipping away at this a little over time, manually re-assigning posts bit by bit.

A new question / issue, though. When I use the standard Search > text.string (since the user always "signed" their posts with their username), it returns the max 10 pages of results.

How do I get all results without stopping at the 10th page?
I've coded an add on that will allow for reassigning of posts from a deleted user to another existed user, or from one existing user to another. In case you are interested you can see it here.

 
I've coded an add on that will allow for reassigning of posts from a deleted user to another existed user, or from one existing user to another. In case you are interested you can see it here.

Thanks. This won't work, however, as there are many other post by "Anonymous" that were not this user.
 
Back
Top Bottom