1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Add-on Batch Update Threads - Body Text

Discussion in 'Resource and Add-on Requests' started by Wesker, Jul 7, 2015.

  1. Wesker

    Wesker Active Member

    /admin.php?threads/batch-update

    Batch update threads is an useful tool but it lacks the ability to search threads based on content inside the body. For example, we'd like to search all threads that have a specific link or text phrase.

    Is there currently a way to do this with xF?
     
  2. Mouth

    Mouth Well-Known Member

    More efficient to do it directly at the database level.
     
  3. Wesker

    Wesker Active Member

    Without a doubt but the point is then to apply a change to the selected threads "basically sticky the threads".
     
  4. Mouth

    Mouth Well-Known Member

    You can do that directly at the DB level too
     
  5. Wesker

    Wesker Active Member

    Which table?
     
  6. Mouth

    Mouth Well-Known Member

    Code:
    mysql> describe xf_thread;
    +--------------------+---------------------------------------+------+-----+---------+----------------+
    | Field              | Type                                  | Null | Key | Default | Extra          |
    +--------------------+---------------------------------------+------+-----+---------+----------------+
    | thread_id          | int(10) unsigned                      | NO   | PRI | NULL    | auto_increment |
    | node_id            | int(10) unsigned                      | NO   | MUL | NULL    |                |
    | title              | varchar(150)                          | NO   |     | NULL    |                |
    | reply_count        | int(10) unsigned                      | NO   |     | 0       |                |
    | view_count         | int(10) unsigned                      | NO   |     | 0       |                |
    | user_id            | int(10) unsigned                      | NO   | MUL | NULL    |                |
    | username           | varchar(50)                           | NO   |     | NULL    |                |
    | post_date          | int(10) unsigned                      | NO   | MUL | NULL    |                |
    | sticky             | tinyint(3) unsigned                   | NO   | MUL | 0       |                |
    | discussion_state   | enum('visible','moderated','deleted') | NO   |     | visible |                |
    | discussion_open    | tinyint(3) unsigned                   | NO   |     | 1       |                |
    | discussion_type    | varchar(25)                           | NO   |     |         |                |
    [...]
    
    Do a join on the xf_thread and xf_post tables, and if updating the xf_post.message then also set the corresponding xf_thread.sticky = 1
    Presuming that you want to sticky every thread that contains the link or phrase you're searching for.
     

Share This Page