[agora] agora head last post

Steve Daniels horde at stedaniels.co.uk
Mon Oct 25 11:11:45 PDT 2004


Steve Daniels wrote:

 >
 > Now I just need in threads.php to get thse variables 
'last_message_subject' =>_("Last Post"), 'last_message_author' => 
_("Posted By"), 'last_message_date' => _("Date")
 >
 > populated with the correct info.
 >

Well I've found in /horde/agora/libs/Forums.php this section of code:

/* Get the number of messages. */
             $threads = &Agora_Messages::singleton(array('forum_id' => 
$forum_id));
             $messages = $threads->getThreads($forum_id, true);
             $forums_list[$forum_id]['message_count'] = count($messages);
             if ($forums_list[$forum_id]['message_count'] > 0) {
                 Horde_Array::arraySort($messages, 'message_timestamp', 0);
                 $last = array_pop($messages);
                 $forums_list[$forum_id]['last_message_subject'] = 
$last['message_subject'];
                 $forums_list[$forum_id]['last_message_author'] = 
$last['message_author'];
                 $forums_list[$forum_id]['last_message_date'] = 
strftime($GLOBALS['prefs']->getValue('date_format'), 
$last['message_timestamp']);
                 $forums_list[$forum_id]['last_message_url'] = 
Agora::setAgoraId($forum_id, $last['message_id'], 
Horde::applicationUrl('messages/index.php'));
             } else {
                 $forums_list[$forum_id]['last_message_subject'] = null;
                 $forums_list[$forum_id]['last_message_author'] = null;
                 $forums_list[$forum_id]['last_message_date'] = null;
                 $forums_list[$forum_id]['last_message_url'] = null;
             }


Now all I think I need to do, is modify this a bit, and slot it into 
/horde/agora/libs/Messages.php around this point somewherem, Ideas?

$threads_list = $this->threads->get(DATATREE_FORMAT_FLAT, $thread_root, 
true, '-1', $all_levels ? -1 : 1, true);
         if (is_a($threads_list, 'PEAR_Error')) {
             Horde::logMessage($threads_list, __FILE__, __LINE__, 
PEAR_LOG_ERR);
             $threads_list = array();
         }

         $threads_list = 
$this->threads->getObjects(array_keys($threads_list), 
'DataTreeObject_Message');
         if (empty($threads_list)) {
             return array();
         }

         $threads_array = array();


Thanks for any help offered,

Steve Daniels





More information about the agora mailing list