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.

how to get discussion ID from DiscussionsController. +

edited August 2012 in Vanilla 2.0 - 2.8

How do I get the discussion ID from DiscussionsController_DiscussionOptions_Handler each time it fires?

+How do I do a var dump of $Sender explicit to the function that uses it?

Thanks in advance.

Tagged:

Comments

  • peregrineperegrine MVP
    edited August 2012

    it's a way - may not be the best

     public function DiscussionsController_DiscussionOptions_Handler($Sender){
              $MyDiscussion =  $Sender->EventArguments['Discussion'];
              $DiscussionID = $MyDiscussion->DiscussionID;
              // two ways
                   echo "the discussion id is $DiscussionID";
                   var_dump($DiscussionID);
                  // to dump Sender
                   var_dump($Sender);
                  }
    

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

  • Dude. You are just The Awesome :)

  • Is it your intention to write to a ratings table or just to the rating column in discussions.
    I think your code shows you trying to do half of one and half of the other.
    It may be worth just writing only to a Ratings table with the Discussion Id and Rating and perhaps Author ID, rather than messing with Discussions Table just a thought.

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

  • I had thought writing a rating column to the Discussion table would be the quick and dirty solution. However, I believe you are right. It is better practice to create a new table for the with the Discussion ID as the Primary Key.

Sign In or Register to comment.