How to change the order of messages

16.2. How to change the order of messages

Figure 16-1. Administration panel: Messages.

Administration panel: Messages.



The default for PHP-Nuke is to display messages in ascending order of mid (the id number for each message). You can use Add Story (Figure 7-2) to post articles on your site and these will appear in reverse order, i.e. last posted at the top (see also Section 18.9.1, on how to order articles in Sections and Section 18.11.1, on how to order articles in the Stories Archive). Thus you could have a main "Welcome Message" at the top which will always be there as a home page, followed by a series of announcements appearing in reverse order below the Welcome Message. But what happens if you don't use "Add Story" to add articles, but would rather like to use Messages (Figure 7-17) for communicating your news?

If you really want to use Messages and have them appear in reverse order (last one at the top), you need to edit mainfile.php using a decent editor (see Chapter 11).

At around line 334 in mainfile.php, in function message_box(), change

$sql = "SELECT mid, title, content, date, expire, view 
FROM ".$prefix."_message WHERE active='1' $querylang";

to

$sql = "SELECT mid, title, content, date, expire, view 
FROM ".$prefix."_message WHERE active='1' $querylang ORDER by mid DESC";

and this will display your messages in reverse order (last one at the top). See also How to reverse the order of Messages in the Homepage.

 

Site Info v2.2.2

Last SeenLast Seen
Server TrafficServer Traffic
  • Total: 337,498,376
  • Today: 34,916
Server InfoServer Info
  • Sep 26, 2017
  • 11:15 am PDT
 
 

Daily Inspiration