SMFHacks.com

SMF Classifieds => Support => Topic started by: vkot on March 05, 2014, 03:19:39 am

Title: Not show closed/expired listings (code hack)
Post by: vkot on March 05, 2014, 03:19:39 am
I realize that there is no use for the viewers to see the listings that are closed/expired, so I decided to change the SQL queries to exclude these. Here is what I have done, and it's working (tested in version 3.0.2 and SMF 2.0.x). If you try it and see that I have missed something, please say so.

In classifieds2.template.php change:
for page count:
Code: [Select]
WHERE removed = 0 AND ID_CAT = $cat AND approved = 1");to:
Code: [Select]
WHERE removed = 0 AND ID_CAT = $cat AND approved = 1 AND UNIX_TIMESTAMP() < expiredate");
for view listings:
Code: [Select]
WHERE  i.removed = 0 AND i.ID_CAT = $cat AND i.approved = 1to:
Code: [Select]
WHERE  i.removed = 0 AND i.ID_CAT = $cat AND i.approved = 1 AND UNIX_TIMESTAMP() < i.expiredate
for search results:
Code: [Select]
WHERE  i.approved = 1 " . $class_where ." AND  (" . $context['class_search_query'] . ")to:
Code: [Select]
WHERE  i.approved = 1 " . $class_where ." AND  (" . $context['class_search_query'] . ") AND UNIX_TIMESTAMP() < i.expiredate
Title: Re: Not show closed/expired listings (code hack)
Post by: SMFHacks on March 05, 2014, 07:36:36 am
The only part I would be careful is if you have listings that never expire