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.
Options

Mark Unread

edited December 2007 in Vanilla 1.0 Help
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?
«1

Comments

  • Options
    This sounds a lot like Wanderer's issue: http://lussumo.com/community/discussion/4998/dateless-not-desperate/#Item_0 I think it could be as simple as <tt>DELETE FROM UserDiscussionWatch WHERE DiscussionID = 1234</tt>. Should probably do some magic to change the stickie's date to the edit date. (is that proper use of an apostrophe Wanderer?)
  • Options
    So technically, deleting a row in the LUM_UserDiscussionWatch table should make the discussion "new" again? Or is there something more precise to delete? Sorry but I'm no MySQL specialist, I've already messed a bit in my database to erase comments or users without problems, but I don't understand how this DiscussionWatch stuff exactly works.
  • Options
    Exactly. UserDiscussionWatch is the table that keeps track of which discussions are read by any particular user. Delete all records of a discussion from it and you effectively make that discussion unread for all users.
  • Options
    edited January 2007
    Cool. So in order to make such an extension work, I would need to:

    - 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 :)
  • Options
    Looks good. Only clarification would be that each discussion has multiple rows in UserDiscussionWatch--one for every user who read it. That won't be a problem as that delete statement I posted earlier will delete all of them.
  • Options
    Oh ok, I was wondering how a single row could be used for all users, silly me :) Thanks.
  • Options
    I'm bumping this with the addition that, I use my forum as a support forum. Sometimes I access the forum at like 2am when I can't sleep and read something that I really can't resolve at that point anyways and make a mental note to address it in the morning. It would be cool to mark as "unread" so that in the morning, after I've had my coffee, I could log in and it showing up as a new comment would remind me that I have to read it again. Otherwise, as I do now, I just forget about it.
  • Options
    Yep, it could be useful for this too. Your comment makes me think this stuff needs to be role-based, it's one more detail I have to consider. I've no idea when I'll start trying to code this extension since I'm rather busy at the moment , but I'll try...
  • Options
    i could make this i guess, if u havent started? what I see it needs is this:

    - 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
  • Options
    Mark unread for self/everyone sounds perfect.

    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 :)
  • Options
    half way done now :)
  • Options
    edited April 2007
    hit a bit of a snag. Im not to steady on the ajax calls. If someone could lend me a hand, im sure we could get this done by today. Here Is what I got so far:<?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;\""); } ?>
  • Options
    Would somebody have a clue? I wish I could help but ajax stuff is something I just don't understand.
  • Options
    Let's bump this.
  • Options
    lechlech Chicagoland
    What about instead treating the stickied as a "hot topic" after so many replies go unread by any given user which flips the class from read to unread? This could easily be applied to all other threads as well and if you like you could create a "hot topic" class to color everything appropriately instead of it just appearing as new.

    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.
  • Options
    edited May 2007
    Yeah, sounds like a good idea :)

    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.
  • Options
    *bump* Did we get any closer with this?
  • Options
    @ zero
    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
  • Options
    Clever trick :)

    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.
  • Options
    It works fine. However, is there a way to display the [hot] stuff like the other labels?

    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.
This discussion has been closed.