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

XF 1.1 Query To Add Prefix To All Threads in X Forum

Discussion in 'XenForo Questions and Support' started by BamaStangGuy, May 20, 2012.

  1. BamaStangGuy

    BamaStangGuy Well-Known Member

    I need a query so that I can update all threads that reside in a certain forum with an existing thread prefix.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Code:
    UPDATE xf_thread
    SET prefix_id = 1
    WHERE node_id = 29;
    
    You need to specify the prefix_id and node_id.
     
    8thos, Morgain, Learner and 1 other person like this.
  3. BamaStangGuy

    BamaStangGuy Well-Known Member

    It's odd that you ad the exact query I needed to run, from prefix_id to node_id lol
     
  4. Morgain

    Morgain Well-Known Member

    Thanks Jake. Where can I look up how to do a query?

    Can a query do a series of forums in one go if the prefix added is the same
    applying the prefix to a whole lot of forums?
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can run queries using phpmyadmin which is a program that many hosts will preinstall for you.

    Here is a query to specify multiple nodes:

    Code:
    UPDATE xf_thread
    SET prefix_id = 1
    WHERE node_id IN (29,30,31,32);
    
     
    Morgain likes this.
  6. Morgain

    Morgain Well-Known Member

    Wheeee! thanks Jake it looks SO pwetty!

    pfix.png
     
    Jake Bunce likes this.
  7. graham_w

    graham_w Active Member


    Hi Jake
    I'd like to use this to change all prefixes on threads older than 6 months (or 180 days) old. Would I need to add :

    and post_date < xxxxxxxxxxxx;

    and work out the date code for 180 days ago ?
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Try this:

    Code:
    UPDATE xf_thread
    SET prefix_id = 1
    WHERE node_id = 29
    AND post_date < UNIX_TIMESTAMP() - (86400*180);
    
     

Share This Page