ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Automatically Expire Entries - with SQL Query?

March 23, 2011 4:31pm

Subscribe [3]
  • #1 / Mar 23, 2011 4:31pm

    ovation01

    42 posts

    I need to find a way to automatically expire my entries that have been open for X days (in Y weblog and Z categories).

    I’ve heard of a “Auto-Expire Extension” but can’t find it in the add-on list.

    So I figured I could run a query off a cron to auto-expire entries that have been open X days… problem is I’m an SQL newbie.

    I’d like to modify this script in the wiki - Automatically Close Expired Entries

    Does anyone know how to modify the query below to expire entries that are:

    1. X days old or older

    2. In a certain weblog (I assume doing “WHERE weblog_id = X”)

    3. In a certain category

    Here’s the query to modify:

    UPDATE `exp_weblog_titles` 
    SET expiration_date = 'UNIX_TIMESTAMP()' 
    WHERE expiration_date = '0' 
    AND entry_date < UNIX_TIMESTAMP()

    Thanks for any ideas!

  • #2 / Mar 23, 2011 9:25pm

    leeaston

    634 posts

  • #3 / Mar 24, 2011 12:15pm

    Sue Crocker

    26054 posts

    Thanks for the assist, Lee.

    Carlyn, will that add-on work for you?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases