Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Mark Unread
Hi folks.
Everytime I update a sticky, I think: "Why am I updating this, since people won't even notice there's something new here?"
Of course, I could add a new comment to make the discussion "new", but stickies should stay short and clear when they are about forum rules, formating hints and stuff like that, don't you think? I could also create a new sticky to replace the one I'm supposed to update, but then I'll end with dozen of useless posts with the same name. Or I could go in the database and erase them manually... Or even make them "new" manually... And that's what I'd like to avoid.
So, could somebody tell me where to start to make a simple "Mark Unread" extension? I was thinking about a link in the side panel, along with the hide/sticky/bookmark/sink options, depending of the role of the user. I suppose I could have a look at the Mark All Read extension and try to figure out how it works, but I'm pretty sure it doesn't work the same way. What do you guys think?
Everytime I update a sticky, I think: "Why am I updating this, since people won't even notice there's something new here?"
Of course, I could add a new comment to make the discussion "new", but stickies should stay short and clear when they are about forum rules, formating hints and stuff like that, don't you think? I could also create a new sticky to replace the one I'm supposed to update, but then I'll end with dozen of useless posts with the same name. Or I could go in the database and erase them manually... Or even make them "new" manually... And that's what I'd like to avoid.
So, could somebody tell me where to start to make a simple "Mark Unread" extension? I was thinking about a link in the side panel, along with the hide/sticky/bookmark/sink options, depending of the role of the user. I suppose I could have a look at the Mark All Read extension and try to figure out how it works, but I'm pretty sure it doesn't work the same way. What do you guys think?
0
This discussion has been closed.
Comments
- Display a link in the panel for each discussion (set by the user's role),
- get the discussion ID by clicking this link,
- delete the discussion's row following its ID in LUM_UserDiscussionWatch.
It doesn't sound too complicated. Did I miss something? Thanks for the hint, I'll give it a try (even if I'm pretty sure I'll end up by doing this manually
- 2 new role permissions
- Can Mark as Unread for everyone
- Can Mark as Unread for self
- 2 new panel menu lists for marking as unread, one for self and one for all
- the sql call for deleting from db.
should be straight forward
You seem to be far more experienced with PHP than I am, so if you have the time, don't hesitate. I prefer something that wasn't made by me that works than a crappy cut-n-pasted frankenstein-like extension
<?php // sets up the thew new permissions $Context->Configuration['PERMISSION_MARK_UNREAD'] = '0'; $Context->Configuration['PERMISSION_MARK_UNREAD_ALL'] = '0'; // sets default language text for permissions $Context->SetDefinition('PERMISSION_MARK_UNREAD', 'Can Mark as Unread for self'); $Context->SetDefinition('PERMISSION_MARK_UNREAD_ALL', 'Can Mark as Unread for everyone (should be admin only)'); // set up the button texts: $Context->SetDefinition('Mark as Unread', 'Mark as Unread'); $Context->SetDefinition('Reset Discussion', 'Reset Discussion'); // set up dialog text $Context->SetDefinition('ConfirmUnreadDiscussion', 'Are you sure you want to mark this discussion as Unread?'); $Head->AddScript("extensions/DojoUnread/dojounread.js"); $Options = $Context->GetDefinition("Options"); if ('comments.php' == $Context->SelfUrl && $Context->Session->UserID > 0 && $Context->Session->User->Permission("PERMISSION_MARK_UNREAD")) { $CloseText = $Context->GetDefinition("Mar as Unread"); $Panel->AddListItem($Options, $CloseText, "./", "", "id=\"MarkUnread\" onclick=\"if (confirm('".$Context->GetDefinition("ConfirmUnreadDiscussion")."')) markUnread(". $CommentID .") ); return false;\""); } ?>
This would save you from having to append permissions to roles and allow the forum take care of this on it's own based on user interaction.
Just a thought.
Not exactly what I meant because in my case it's mostly for administrative purposes (read this damn sticky again pleeeaaase) but what you're suggesting is definitely interesting. Having a special label, something like [Hot], along with [Sticky], [Sink] and stuff like that, would be something to consider. Maybe a discussion could get [Hot] after a given amount of comments and stay stickied for, let's say, one week, before going back to normal if no more comment is added in the meanwhile.
Seems like two different extensions would make more sense, though.
Open up Discussio.php in the themes folder
line 14 change it to this
<span>'.$this->Context->GetDefinition('DiscussionType').'</span>'.DiscussionPrefix($this->Context, $Discussion).($Discussion->CountComments >20 ?' [Hot]':'') .'
essentially check for total comments, if more than a certain number I used 20 in my example, if yes display [Hot] else nothing
you can do that and add a css class as Hot and style it appropriately
Thanks, I'll give it a try. This is especially interesting since one of my custom themes doesn't display the number of comments in the discussion list. I think I'll add a language definition for a better localization though.
I mean something like:
[Bookmarked, Closed, Hot]
instead of
[Bookmarked, Closed] [Hot]
It would also be nice to have a discussion filter to show only hot stuff. I think I'm gonna dig into other extensions using filters and see if I can code something.