/** * * * @param $Sender * @param $Args * @throws Gdn_UserException */ public function commentModel_afterSaveComment_handler($Sender, $Args) { if (!$this->socialSharing() || !$this->accessToken()) { return; } $Share = valr('FormPostValues.ShareTwitter', $Args); if ($Share && $this->accessToken()) { $Row = $Args['FormPostValues']; $DiscussionModel = new DiscussionModel(); $Discussion = $DiscussionModel->getID(val('DiscussionID', $Row)); if (!$Discussion) { return; } $Url = DiscussionUrl($Discussion, '', true); $Message = SliceTwitter(Gdn_Format::plainText($Row['Body'], $Row['Format'])) . ' ' . $Url; $R = $this->API('/statuses/update.json', array('status' => $Message), 'POST'); } }
public function CommentModel_AfterSaveComment_Handler($Sender, $Args) { if (!$this->SocialSharing()) { return; } if (!$this->AccessToken()) { return; } $Share = GetValueR('FormPostValues.ShareTwitter', $Args); if ($Share && $this->AccessToken()) { $Row = $Args['FormPostValues']; $DiscussionModel = new DiscussionModel(); $Discussion = $DiscussionModel->GetID(GetValue('DiscussionID', $Row)); if (!$Discussion) { return; } $Url = DiscussionUrl($Discussion, '', TRUE); $Message = SliceTwitter(Gdn_Format::PlainText($Row['Body'], $Row['Format'])) . ' ' . $Url; $R = $this->API('/statuses/update.json', array('status' => $Message), 'POST'); // decho($R); // die(); // } else { // die("$Share ".$this->AccessToken()); } }