Yes, it works currently but as a side effect, when a discussion is longer then a page, the unread comment is not updated, so it always shows that you have unread items. If you go to the last page then the unread items will disappear.
csakip said:
Yes, it works currently but as a side effect, when a discussion is longer then a page, the unread comment is not updated, so it always shows that you have unread items. If you go to the last page then the unread items will disappear.>
the side effect is a pretty sticky wicket and looks like it would probably be fairly difficult to make it work as hoped.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
I've managed to find a dirty solution to the problem that the unread comments doesn't get updated. Since now when you visit the discussion, you see the last comment on top, this will clear the unread comments no matter what.
You should insert this into the plugin's class:
public function DiscussionController_BeforeDiscussionRender_Handler($Sender) {
if($Sender->Discussion->CountComments > 1) { //This check is a dirty solution so it won't throw an error on new discussion creation :)
$Sender->CommentModel->SetWatch($Sender->Discussion, $Sender->Discussion->CountComments, 0, $Sender->Discussion->CountComments);
}
}
public function DiscussionController_BeforeDiscussionRender_Handler($Sender) {
if($Sender->Discussion->CountComments > 2) { //This check is a dirty solution so it won't throw an error on new discussion creation :)
$Sender->CommentModel->SetWatch($Sender->Discussion, $Sender->Discussion->CountComments, 0, $Sender->Discussion->CountComments);
}
}
hey man, i've got this question open a long time ago i'd like to try your dirty solution, i'll give you a message if i can get this to work on my site ;)
Answers
Yes, it works currently but as a side effect, when a discussion is longer then a page, the unread comment is not updated, so it always shows that you have unread items. If you go to the last page then the unread items will disappear.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •the side effect is a pretty sticky wicket and looks like it would probably be fairly difficult to make it work as hoped.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •I've managed to find a dirty solution to the problem that the unread comments doesn't get updated. Since now when you visit the discussion, you see the last comment on top, this will clear the unread comments no matter what.
You should insert this into the plugin's class:
public function DiscussionController_BeforeDiscussionRender_Handler($Sender) { if($Sender->Discussion->CountComments > 1) { //This check is a dirty solution so it won't throw an error on new discussion creation :) $Sender->CommentModel->SetWatch($Sender->Discussion, $Sender->Discussion->CountComments, 0, $Sender->Discussion->CountComments); } }- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •I correct myself. Try this:
public function DiscussionController_BeforeDiscussionRender_Handler($Sender) { if($Sender->Discussion->CountComments > 2) { //This check is a dirty solution so it won't throw an error on new discussion creation :) $Sender->CommentModel->SetWatch($Sender->Discussion, $Sender->Discussion->CountComments, 0, $Sender->Discussion->CountComments); } }- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •hey man, i've got this question open a long time ago i'd like to try your dirty solution, i'll give you a message if i can get this to work on my site ;)
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •