Man this forum post is getting huge... would it be possible to delete some of the older postings about older versions that are no longer relevent?
Any way, here’s my question:
We’re using NewsListing to create a "Recently Added" section to the front of our website. I thought everything was working great (sorting by pub_date) until I noticed that in cases where the pub_date was not set, it was reverting back to the createdon date. Found the code where this happens in line 167 of functions.php:
$query= "SELECT id , type , contentType , pagetitle , longtitle , description , alias , published , IF(pub_date > 0, pub_date, createdon) as pub_date, IF(unpub_date > 0, unpub_date, createdon) as unpub_date , parent , isfolder , introtext , content , richtext , template , menuindex , searchable , cacheable , createdby , createdon, editedby , IF(editedon > 0, editedon, createdon) as editedon, deleted , IF(deletedon > 0, deletedon, createdon) as deletedon, deletedby , menutitle , donthit , haskeywords , hasmetatags , privateweb , privatemgr , content_dispo , hidemenu FROM $tblContent WHERE parent IN ($validParents) $activeClause $folderClause ORDER BY $sortby $sortdir";
Is it really necessary to have these IF statements? I was really confused because I expected it to sort by pub_date (knowing the value would be 0 if unset) only to find that it was putting in the createdon date. Has anyone else been confused by this? I’d like to avoid modifying the code to suit my needs, but I also would like it to work as expected. Any suggestions?
This snippet is awesome by the way. We even used it to do a photo gallery:
http://www.everynation.org/en/navigation-menu-top/photo-gallery/the-year-in-pictures.html
Thanks!