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.

Gdn Model return empty array via plugin hook only

I refer to my Kudos plugin (
I make an sql query via a class that extends gdn_model that returns an array.
If I make the exact call via DiscussionController_AfterCommentBody_Handler it returns an array with data inside it, but if i make that call via DiscussionController_Kudos_Create it returns an empty array (this is strange, if I print it is not empty!)

here's the code:
public function GetCommentKudos($CommentID) { if(!$this->Kudos['c']) { $Kudos = $this->SQL->Select()->From($this->Name . ' p') ->Join('User u', 'u.UserID = p.UserID') ->Where(Array('CommentID' => $CommentID)) ->OrderBy('CommentID') ->Get()->Result(DATASET_TYPE_OBJECT); $this->Kudos['c'][$CommentID] = $Kudos; } else { $Kudos = $this->Kudos['c'][$CommentID]; } $loves = array(); $hates = array(); foreach($Kudos as $K) { if($K->Action == 1) $loves[$K->UserID] = $K->Name; if($K->Action == 2) $hates[$K->UserID] = $K->Name; } return array('l' => $loves, 'h' => $hates); }

that returning array contains data.
Sign In or Register to comment.