/** * Triggers when an event is created * * @since 1.3 * @access public * @param SocialEvent The event object * @param SocialUser The user object * @param bool Determines if the event is a new event * @return */ public function onEventAfterSave(SocialEvent &$event, SocialUser &$author, $isNew) { // When a new event is created, we want to ensure that it's stored in the user's calendar if ($isNew) { $eventstart = $event->getEventStart(); $eventend = $event->getEventEnd(); // Ensure that the start and end date is set if (!$eventstart && !$eventend) { return; } $calendar = FD::table('Calendar'); // Get the start and end date $calendar->title = $event->getName(); $calendar->description = $event->description; $calendar->uid = $event->id; $calendar->type = SOCIAL_TYPE_EVENT; $calendar->date_start = $eventstart->toSql(); $calendar->date_end = $eventend->toSql(); $calendar->user_id = $author->id; $calendar->store(); } }