[SPT/CWIS] Forum Message Count Error
Edward Almasy
ealmasy at scout.wisc.edu
Tue Jan 16 14:16:43 CST 2007
On Jan 11, 2007, at 10:32 AM, Ale Fernandez wrote:
> 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();
> }
> }
I think the problem may be with this line:
$Forum = & new Forum($Message->ParentId());
Which should instead read:
$Forum = & new Forum($Topic->ForumId());
Ed
---
Edward Almasy
ealmasy at scout.wisc.edu
Co-Director 1210 W Dayton
Street
Internet Scout Madison
WI 53706
Computer Sciences Department 608-262-6606
(voice)
University of Wisconsin - Madison
608-265-9296 (fax)
More information about the SPT-CWIS-Users
mailing list