XF 2.0 [How to SQL?]Update every threads' first post in node=x with a string

sbj

Well-known member
Hey,
I want to save a lot of time.

There is node x. In node x there are 1000+ threads.
I want to update all first posts by inserting a one-liner at the end of the first post. How can I do it?

It is tiresome to update all first posts manually with copy/paste over and over again. Any help is appreciated.

Thanks
 
Wait, with template modifications I can insert messages into posts?

Or are you suggestion I should display that on the templates, but in real it is not saved in the post?

I needed it to be saved in the post.

Any chance doing this without writing a php script and doing it a SQL Update?
 
Or are you suggestion I should display that on the templates, but in real it is not saved in the post?
Yea, this.

Saving in the database should be something like this:
SQL:
UPDATE xf_post SET message = CONCAT(message, "your additional message")
WHERE post_id IN
(
    SELECT first_post_id FROM xf_thread
    WHERE node_id = X
)
Haven't tested it so try it on your dev server first.
 
  • Like
Reactions: sbj
Back
Top Bottom