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

Generating error when accessing discutions

edited December 2014 in Vanilla 2.0 - 2.8

This plugin was generating an error. Vanilla version is 2.1.6

So, after DEBUG enabling, I receive this message:

DiscussionController->Options not found.
The error occurred on or near: /applications/vanilla/controllers/class.discussioncontroller.php

40: Deprecated('DiscussionController->CommentData', "DiscussionController->Data('Comments')");
41: return $this->Data('Comments');
42: break;
43: }
44: throw new Exception("DiscussionController->$Name not found.", 400);
45: }
46:
47: /**
48: * Default single discussion display.

Backtrace:

[/plugins/SendPM/class.sendpm.plugin.php:39] DiscussionController->__get();
[/library/core/class.pluginmanager.php:705] SendPMPlugin->DiscussionController_CommentOptions_Handler();
[/library/core/class.pluginmanager.php:638] Gdn_PluginManager->CallEventHandler();
[/library/core/class.pluggable.php:144] Gdn_PluginManager->CallEventHandlers();
[/applications/vanilla/views/discussion/helper_functions.php:334] Gdn_Pluggable->FireEvent();
[/applications/vanilla/views/discussion/helper_functions.php:351] PHP::GetCommentOptions();
[/applications/vanilla/views/discussion/helper_functions.php:88] PHP::WriteCommentOptions();
[/applications/vanilla/views/discussion/comments.php:19] PHP::WriteComment();
[/applications/vanilla/views/discussion/index.php:52] PHP::include();
[/library/core/class.controller.php:779] PHP::include();
[/library/core/class.controller.php:1245] Gdn_Controller->FetchView();
[/library/core/class.pluggable.php:210] Gdn_Controller->xRender();
[/applications/vanilla/controllers/class.discussioncontroller.php:234] Gdn_Pluggable->__call();
[/applications/vanilla/controllers/class.discussioncontroller.php:234] DiscussionController->Render();
[/applications/vanilla/controllers/class.discussioncontroller.php:234] DiscussionController->Index();
[/library/core/class.dispatcher.php:350] PHP::call_user_func_array();
[/index.php:46] Gdn_Dispatcher->Dispatch();
Tagged:

Comments

  • Options
    peregrineperegrine MVP
    edited November 2014

    @cheilenereinfo

    I am not supporting plugin, however this modification may work for you. If it does great. It worked for me making the following changes.

    here is some code to work with vanilla 2.1

    it adds option within discussion page for users to send a pm to the author of comment in comments or author of discussion in initial post.

    in class.sendpmplugin.php

    replace all the code with this:

        class SendPMPlugin extends Gdn_Plugin {
    
        // add pm to author of comment in comment options
           public function DiscussionController_CommentOptions_Handler($Sender,$Args) { 
              $Session = Gdn::Session();
              if ( $Session->IsValid() ) {
               $PM = $Args['Comment']->InsertName;
    
                 $Label = T('Send PM');
                 $Url = "/messages/add/{$PM}";
                 if (isset($Sender->Options)) {
                    $Sender->Options .= Wrap(Anchor($Label, $Url, 'Send PM'), 'li');
                 }
                 else {
                    $Args['CommentOptions']['SendPM'] = array(
                       'Label' => $Label,
                       'Url' => $Url,
                       'Class' => 'SendPM'
                    );
                 }
              }
           }
    
         // add pm to author of discussion in initial post.
        public function DiscussionController_DiscussionOptions_Handler($Sender,$Args) { 
              $Session = Gdn::Session();
              if ( $Session->IsValid() ) {
               $PM = $Args['Discussion']->InsertName;
    
                 $Label = T('Send PM');
                 $Url = "/messages/add/{$PM}";
                 if (isset($Sender->Options)) {
                    $Sender->Options .= Wrap(Anchor($Label, $Url, 'Send PM'), 'li');
                 }
                 else {
                    $Args['DiscussionOptions']['SendPM'] = array(
                       'Label' => $Label,
                       'Url' => $Url,
                       'Class' => 'SendPM'
                    );
                 }
              }
           }
    

    sample screenshot in discussion in vanilla 2.1 with code changes.

    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

    @fraxture‌

    please read the comments above.

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

Sign In or Register to comment.