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.

New Discussions

NickENickE New
edited January 2007 in Vanilla 1.0 Help
New Discussions


  • Options
    great extension! at the top of the unread discussions page it says:

    All Discussions : New Discussions

    is there any way to get rid of All Discussions so the heading of the page is just:
    New Discussions
  • Options
    CountComments DO NOT include Whispers. So, if there is at least one whisper comment in the discussion, then this add-on may works un-correctly. I rewrite some code, so it should work correctly now. If you want to understand changes - see comments in the code.

    P.S. I did not test it in real situations, but my home local tests were good. So this code must be checked before publication in add-on.

    if($Context->SelfUrl == 'index.php' && ForceIncomingString('View', '') == 'NewDiscussions' && $Context->Session->User->UserID) { $Context->AddToDelegate('DiscussionManager', 'PostGetDiscussionBuilder', 'NewDiscussionsBuilder'); $Context->AddToDelegate('DiscussionManager', 'PreGetDiscussionCount', 'NewDiscussionsCounter'); $Context->AddToDelegate('DiscussionGrid', 'Constructor', 'NewDiscussionsConstructor'); if(ND_ADD_TAB) $Context->AddToDelegate('Menu', 'PreRender', 'NewDiscussionsSetTab'); function NewDiscussionsBuilder(&$D) { $s = &$D->DelegateParameters['SqlBuilder']; $s->AddWhere('t', 'CountComments', 'utw', 'CountComments', '>', 'and', '', 0, 1); $s->AddWhere('', '', 'utw', 'CountComments', '', 'or', 'ISNULL', 0, 0); // last date in discussion (NOT include Whispers date) > history date $s->AddWhere('t', 'DateLastActive', 'utw', 'LastViewed', '>', 'or', '', 0, 0); // if user can view all whispers if ($D->Context->Session->User->Permission('PERMISSION_VIEW_ALL_WHISPERS')) { // then count comments + total whisper count of a theme > history count comments $s->AddWhere('', 't.CountComments+t.TotalWhisperCount', '', 'utw.CountComments', '>', 'or', '', 0, 0); // else } else { // all incoming + all outcoming whispers + count comments (CountComments DOES NOT include Whispers) > history count comments $s->AddWhere('', 'tuwf.CountWhispers+tuwt.CountWhispers+t.CountComments', 'utw', 'CountComments', '>', 'or', '', 0, 0); } $s->EndWhereGroup(); //echo $s->GetSelect(); } function NewDiscussionsCounter(&$D) { $D->DelegateParameters['SqlBuilder']->AddJoin( 'UserDiscussionWatch', 'utw', 'DiscussionID', 't', 'DiscussionID', 'left join', ' and utw.'.$D->Context->DatabaseColumns['UserDiscussionWatch']['UserID'].' = '. $D->Context->Session->UserID ); if (!$D->Context->Session->User->Permission('PERMISSION_VIEW_ALL_WHISPERS')) { $D->DelegateParameters['SqlBuilder']->AddJoin( 'DiscussionUserWhisperFrom', 'tuwf', 'DiscussionID', 't', 'DiscussionID', 'left join', ' and tuwf.'.$D->Context->DatabaseColumns['DiscussionUserWhisperFrom']['LastUserID'].' = '. $D->Context->Session->UserID ); $D->DelegateParameters['SqlBuilder']->AddJoin( 'DiscussionUserWhisperTo', 'tuwt', 'DiscussionID', 't', 'DiscussionID', 'left join', ' and tuwt.'.$D->Context->DatabaseColumns['DiscussionUserWhisperTo']['LastUserID'].' = '. $D->Context->Session->UserID ); } NewDiscussionsBuilder($D); } function NewDiscussionsConstructor(&$F) { $F->Context->PageTitle .= ' : '.$F->Context->GetDefinition('NewDiscussions'); } function NewDiscussionsSetTab(&$F) { $F->CurrentTab = 'new_discussions'; } }
  • Options
    This just plain doesn't work for me. I'm using Vanilla 1.1.5a. Anyone else had any trouble with this extension?
Sign In or Register to comment.