Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

view Resolved/Unresolved all members; members can Rsolve their own topics

Hello members,

I was wondering if it is possible in this plugin that all members can view if discussions are resolved or unresolved.
And if it is possible that members can edit their own discussions as "Resolved".
At this moment there is only an option to manage in the permission the control of it. If for members not enabled, they can not see if topics are resolved. If enabled, they can control of all the topics.

Tagged:

Comments

  • Options

    part one.

    I was wondering if it is possible in this plugin that all members can view if discussions are resolved or unresolved.

       /**
        * Show Unresolved meta tag.
        */
      public function Base_BeforeDiscussionMeta_Handler($Sender, $Args) {
          $Resolved = GetValue('Resolved', GetValue('Discussion', $Args));
       //  if (CheckPermission('Plugins.Resolved.Manage') && !$Resolved) {
        if (!$Resolved) {
             echo ' <span class="Tag Tag-Unresolved">'.T('Unresolved').'</span> ';
          }
       }
    
    
       /**
        * Show [RESOLVED] in discussion title when viewing single.
        */
       public function DiscussionController_BeforeDiscussionOptions_Handler($Sender, $Args) {
          $Discussion = $Sender->Data('Discussion');
       //  if (CheckPermission('Plugins.Resolved.Manage') && $Discussion->Resolved) {
          if ($Discussion->Resolved) {
    

    as for the other you would need to check SessionID vs Discussion InsertUserID.

    if no one helps with the other or linc doesn't add your feature request, and you want to pm to do it for you for hire, let me know.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    LincLinc Detroit Admin

    That's the plugin managing our internal support queue at the moment so I'm not inclined to take feature requests for it, no, sorry.

  • Options
    jackmaessenjackmaessen ✭✭✭
    edited November 2014

    thank you @peregrine; this was very helpful.
    I made some other changes in the meta tag of the topics, you can also see in there wether a topic is solved or not:
    /** * Show Unresolved meta tag. */ public function Base_BeforeDiscussionMeta_Handler($Sender, $Args) { $Resolved = GetValue('Resolved', GetValue('Discussion', $Args)); // DISABLED if (CheckPermission('Plugins.Resolved.Manage') && !$Resolved) { if (!$Resolved) { echo ' <span class="Tag Tag-Unresolved">'.T('Unresolved').'</span> '; } elseif ($Resolved) { echo ' <span class="Tag Tag-Resolved">'.T('&#10004;&nbsp;Resolved').'</span> '; // added } }

    and
    `

      // Resolve the discussion.
      $Sender->DiscussionModel->SetField($DiscussionID, 'Resolved', $Resolve);
      $Discussion->Resolved = $Resolve;
    
      $Sender->SendOptions($Discussion);
    
      if (!$Resolve) {
         require_once $Sender->FetchViewLocation('helper_functions', 'Discussions');
         $Sender->JsonTarget(".Section-DiscussionList #Discussion_$DiscussionID .Meta-Discussion", 
            '<span class="Tag Tag-Unresolved" title="Unresolved">'.T('Unresolved').'</span>', 'Prepend');
         $Sender->JsonTarget(".Section-DiscussionList #Discussion_$DiscussionID", 'Unresolved', 'AddClass');
    
         $Sender->JsonTarget(".Section-DiscussionList #Discussion_$DiscussionID .Tag-Resolved", NULL, 'Remove');  // added   
         $Sender->JsonTarget(".Section-DiscussionList #Discussion_$DiscussionID", 'Resolved', 'RemoveClass');  // added
    
      } else {
    
         $Sender->JsonTarget(".Section-DiscussionList #Discussion_$DiscussionID .Meta-Discussion", // added
            '<span class="Tag Tag-Resolved" title="Resolved">'.T('&#10004;&nbsp;Resolved').'</span>', 'Prepend'); // added
         $Sender->JsonTarget(".Section-DiscussionList #Discussion_$DiscussionID", 'Resolved', 'AddClass'); // added
    
         $Sender->JsonTarget(".Section-DiscussionList #Discussion_$DiscussionID .Tag-Unresolved", NULL, 'Remove');     
         $Sender->JsonTarget(".Section-DiscussionList #Discussion_$DiscussionID", 'Unresolved', 'RemoveClass');
      }`
    

    http://forum.webprofis.nl/ ("✔ Opgelost" = Resolved and "Actueel..." = Unresolved)

  • Options
    peregrineperegrine MVP
    edited November 2014

    @jackmaessen said: thank you @peregrine; this was very helpful.

    glad it got you on your way, in what you want to achieve.

    since you seem to have tried various plugins - you might want to add here what you like... trying to get some people to post so others who are not aware of certain plugins get some ideas, and developers get some kudos.

    http://vanillaforums.org/discussion/28401/vanilla-awards-for-best-community-developed-plugin-theme-and-application

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    I finally find the way for staff and topic starter to mark discussions as Resolved:

    /**
        * Allow staff to Resolve via discussion options.
        */
       public function Base_DiscussionOptions_Handler($Sender, $Args) {
          $Session = Gdn::Session(); // added defenitie session
          $Discussion = $Args['Discussion'];
          $Resolved = GetValue('Resolved', $Discussion);
          $NewResolved = (int)!$Resolved; 
          //if (CheckPermission('Plugins.Resolved.Manage') or $Session->UserID == $Discussion->InsertUserID) { // ORIGINAL
            if ($Session->CheckPermission('Garden.Moderation.Manage') or $Session->UserID == $Discussion->InsertUserID) { // Catch Staff and TopicStarter
             $Label = T($Resolved ? 'Unresolve' : 'Resolve');
             $Url = "/discussion/resolve?discussionid={$Discussion->DiscussionID}&resolve=$NewResolved";
             // Deal with inconsistencies in how options are passed
             if (isset($Sender->Options)) {
                $Sender->Options .= Wrap(Anchor($Label, $Url, 'ResolveDiscussion Hijack'), 'li');
             }
             else {
                $Args['DiscussionOptions']['ResolveDiscussion'] = array(
                   'Label' => $Label,
                   'Url' => $Url,
                   'Class' => 'ResolveDiscussion Hijack'
                );
             }
          }
       }
    

    and don't forget:

      /**
        * Handle discussion option menu Resolve action.
        */
       public function DiscussionController_Resolve_Create($Sender, $Args) {
          //$Sender->Permission('Plugins.Resolved.Manage');  // DISABLED to allow staff and TopicStarter to Solve
          $DiscussionID = $Sender->Request->Get('discussionid');
          $Resolve = $Sender->Request->Get('resolve');
    

    Personal addition:

     /**
        * Show Unresolved or Resolved meta tag.
        */
       public function Base_BeforeDiscussionMeta_Handler($Sender, $Args) {
          $Resolved = GetValue('Resolved', GetValue('Discussion', $Args));
          //if (CheckPermission('Plugins.Resolved.Manage') && !$Resolved) {  // this was ORIGINAL
            if (!$Resolved) { // REPLACED ONE; now everybody can see if discussions are solved or not
             echo ' <span class="Tag Tag-Unresolved">'.T('').'</span> '; // T is empty; don't show "Unresolved" in meta tag
          }
          else { // added 
            echo ' <span class="Tag Tag-Resolved">'.T('Resolved').'</span> '; // added; Resolved in meta tag
          } // added
       }
    
Sign In or Register to comment.