Simple Machines Community Forum

General Community => Scripting Help => Topic started by: oscar2001 on August 14, 2004, 07:39:09 PM

Title: locking old posts
Post by: oscar2001 on August 14, 2004, 07:39:09 PM
G`day all

I wannna lock all posts which have had no replies in a 30 day time period..
I was wondering if anyone knows a querie I can use to do so?
thanks :)
Title: Re: locking old posts
Post by: [Unknown] on August 14, 2004, 10:11:19 PM
Are you on MySQL 4 or 3?

-[Unknown]
Title: Re: locking old posts
Post by: oscar2001 on August 15, 2004, 05:03:41 AM
4.0.18 :)
Title: Re: locking old posts
Post by: [Unknown] on August 15, 2004, 09:49:11 PM
UPDATE topics AS t, messages AS m
SET t.locked = 1
WHERE m.ID_MSG = t.ID_LAST_MSG
   AND m.posterTime < UNIX_TIMESTAMP('YYYY-MM-DD');

That *should* work, but it's untested.  Just put the desired date in for YYYY-MM-DD.

-[Unknown]
Title: Re: locking old posts
Post by: oscar2001 on August 15, 2004, 11:38:32 PM
I might be doing something wrong but I get this after running the querie

QuoteError

SQL-query : 

UPDATE topics AS t,
messages AS m SET t.locked =1 WHERE m.ID_MSG = t.ID_LAST_MSG AND m.posterTime < UNIX_TIMESTAMP( '2004-09-15' )

MySQL said:


#1146 - Table 'worldcic_yabbse.topics' doesn't exist

Title: Re: locking old posts
Post by: [Unknown] on August 16, 2004, 12:55:52 AM
Change "topics" to include your prefix, for example "smf_topics" or "yabbse_topics".  Same for "members".

-[Unknown]
Title: Re: locking old posts
Post by: oscar2001 on August 16, 2004, 02:40:35 AM
Cool :)
works great after adding the prefixes to topics and messages..

Thanks a lot :)