/** * Processes as soon as the story is saved * * @since 4.0 * @access public * @param string * @return */ public function onAfterStorySave(SocialStream &$stream, SocialTableStreamItem &$streamItem, SocialStreamTemplate &$streamTemplate) { // Determines if this request is for broadcasting $broadcast = $this->input->get('broadcast_broadcast', false, 'bool'); if (!$broadcast || $streamItem->context_type != 'broadcast') { return; } // Get the broadcast link $link = $this->input->get('broadcast_link', '', 'default'); // Get the broadcast title $title = $this->input->get('broadcast_title', '', 'string'); // Determine which target profile id $profileId = $this->input->get('broadcast_profileId', 0, 'int'); // Determine which type this broadcast is $type = $this->input->get('broadcast_type', 'notification', 'string'); // Get the content $content = $streamTemplate->content; // For broadcasted items, we want to insert a new notification for everyone on the site $model = FD::model('Broadcast'); // To check if user select via notification, save to notification table instead. if ($type == 'popup') { $id = $model->broadcast($profileId, $content, $this->my->id, $title, $link); } else { $id = $model->notifyBroadcast($profileId, $title, $content, $link, $this->my->id); } $streamItem->context_id = $id; // Save the stream object $streamItem->store(); }
/** * Processes after the story is saved so that we can generate a stream item for this * * @since 1.3 * @access public * @param string * @return */ public function onAfterStorySave(SocialStream &$stream, SocialTableStreamItem $streamItem, &$template) { $files = $this->input->get('files', array(), 'array'); if (!$files) { return; } // Add points for the user when they upload a file. FD::points()->assign('files.upload', 'com_easysocial', $this->my->id); // We need to set the context id's for the files shared in this stream. $params = FD::registry(); $params->set('files', $files); $streamItem->params = $params->toString(); $streamItem->store(); }
/** * Processes after the story is saved so that we can generate a stream item for this * * @since 1.3 * @access public * @param string * @return */ public function onAfterStorySave(SocialStream &$stream, SocialTableStreamItem $streamItem, &$template) { $files = $this->input->get('files', array(), 'array'); if (!$files) { return; } // We need to set the context id's for the files shared in this stream. $params = FD::registry(); $params->set('file', $files); $streamItem->verb = 'uploaded'; $streamItem->params = $params->toString(); $streamItem->store(); }