By Brian Carnell
Many months ago, Seth Dillingham posted a Javascript solution for obtaining a list of recently posted messages. It worked very well, but some people still use browsers that don't support Javascript (or don't support it well), or they have Javascript turned off. In addition, for those of us (like me) who are clueless about programming, modifying the script was a bit of a hassle.
Now, however, you can get the same functionality with a lot more options using an Advanced Query page. Here's how I implemented a faster, stronger version of the recent messags feature.
1. Go to the STRUCTURE area of the admin pages and scroll down to the "Add New File or Folder" area. In the "Navigation Title" field, type in the name of page (I just call it RECENT_MESSAGES). For file type select "Advanced Query Page." Click on "Add New File."
2. Find the new file in the list of pages on your site in the structure page and click on it, which should bring up the file properties page for your advanced query.
3. Scroll down to the Query Defaults, and make the following settings:
- Allow search arg overrides? NO (
- Run Query on Load? YES (this tells the system to automagically search when we load the file)
- Show only bound URLs? NO (we want all messages, not just bound URLs)
- Start Date: depends -- I like to show people the last two weeks of messages. To do that, click on "Relative date", set the "Today" box to "-", and type in 14 in the "Days" box.
- End Date: click on "Relative date," set the "Today" box to "+", and type in 1 in the "Days" box.
- Modification Start/End Date: Select NONE on both. You could set these to relative dates too, but personally I think users only care about new messages not messages that have been edited. If you want to bring up messages that have been modified in the last two weeks as well, you need to set these.
- Label: IGNORE.
- Posted By: [ALL]
- Modifed By: [ALL]
- Subject: Leave blank
- Body: Leave blank
- Sort By: DATE. You could also sort by Subject Name, Author, etc., but I think date is most intuitive.
- Sort Descending? YES. If you select No here, the messages will be returned chronologically from first to last message. Selecting Yes will sort messages in reverse chronological from the most recent message to the oldest message. I prefer the later. If you prefer the former, set this option to NO.
- Show Form? NO.
- Items Per Page? Depends. Default is 10 items. I think that's way too few. I typically set this to 30.
That's it. Scroll down and click "Change File Properties" and you're set. Now just bring up the page by typing http://yoursite.com/recent_messages (or whatever you called the file). An example of how this looks at one of my sites can be seen Recent Messages.