[SPT/CWIS] Forum Message Count Error

Ale Fernandez a.fernandez at bristol.ac.uk
Thu Jan 11 10:32:44 CST 2007


Hi,

I'm trying to debug an error we're getting on unix based SPT 
installation - I'm sorry but I don't know if this is a known bug,  but 
I've searched the mailing list and couldn't find anything relevant.

The problem is that if a message is created in the forums, then deleted, 
it's message count (stored in the Forums table) isn't subtracted from, 
despite a line in the function DeleteMessage() that seems to do this (in 
SPT--UpdateTopic.php).

Here is the function, and I've added a ** where I think the error is:

# delete message
function DeleteMessage()
{
     global $ForumId, $ParentId, $MessageId, $ParentType;

     if (!empty($MessageId))
     {
         $Message = & new Message($MessageId);

         # update count for topic and forum
         $Topic = & new Topic($Message->ParentId());
         $MessageCount = $Topic->MessageCount();
         $Topic->MessageCount($MessageCount - 1);

         $Forum = & new Forum($Message->ParentId());
         $MessageCount = $Forum->MessageCount();
         $Forum->MessageCount($MessageCount - 1); **

         # delete the message
         $Message->Delete();
     }
}

Please could you let me know if I'm on the right track, or if there's 
something else I could be doing that could be causing this?

Thanks,

Ale

-- 
Ale Fernandez | a.fernandez at bristol.ac.uk
Technical Researcher, ID group | t:+44 (0)117 928 7192
Institute for Learning and Research Technology



More information about the SPT-CWIS-Users mailing list