function dispatch_creation_activity_update($post_id)
 {
     if (!function_exists('bp_activity_get')) {
         return false;
     }
     // WTF
     $created = $this->_data->get_option('bp-activity_autoupdate-event_created');
     if (!$created) {
         return false;
     }
     $event = new Eab_EventModel(get_post($post_id));
     if (!$event->is_published()) {
         return false;
     }
     $user_link = bp_core_get_userlink($event->get_author());
     $update = false;
     $group_id = $this->_is_group_event($event->get_id());
     $public_announcement = $this->_is_public_announcement($event->get_id());
     if ('any' == $created) {
         $update = sprintf(__('%s created an event', Eab_EventsHub::TEXT_DOMAIN), $user_link);
     } else {
         if ('group' == $created && $group_id) {
             $group = groups_get_group(array('group_id' => $group_id));
             $group_link = bp_get_group_permalink($group);
             $group_name = bp_get_group_name($group);
             $update = sprintf(__('%s created an event in <a href="%s">%s</a>', Eab_EventsHub::TEXT_DOMAIN), $user_link, $group_link, $group_name);
         } else {
             if ('pa' == $created && $public_announcement) {
                 $update = sprintf(__('%s created a public announcement', Eab_EventsHub::TEXT_DOMAIN), $user_link);
             }
         }
     }
     if (!$update) {
         return false;
     }
     $update = sprintf("{$update}, <a href='%s'>%s</a>", get_permalink($event->get_id()), $event->get_title());
     $existing = bp_activity_get(array("filter" => array("object" => 'eab_events', "action" => 'event_created', 'primary_id' => $event->get_id())));
     if (isset($existing['activities']) && !empty($existing['activities'])) {
         return false;
     }
     $activity = array('action' => $update, 'component' => 'eab_events', 'type' => 'event_created', 'item_id' => $event->get_id(), 'user_id' => $event->get_author());
     bp_activity_add($activity);
     if ($this->_data->get_option('bp-activity_autoupdate-created_group_post') && $group_id) {
         global $bp;
         $group_activity = $activity;
         $group_activity['component'] = $bp->groups->id;
         $group_activity['item_id'] = $group_id;
         $group_activity['secondary_item_id'] = $event->get_id();
         $existing = bp_activity_get(array("filter" => array('user_id' => $user_id, "object" => $bp->groups->id, "action" => 'event_created', 'primary_id' => $group_id, 'secondary_id' => $event->get_id())));
         if (isset($existing['activities']) && !empty($existing['activities'])) {
             $old = reset($existing['activities']);
             if (is_object($old) && isset($old->id)) {
                 $group_activity['id'] = $old->id;
             }
         }
         // Add group activity update
         groups_record_activity($group_activity);
     }
 }
 private function _send_notification_email($event_id, $user_id)
 {
     $user = get_user_by('id', $user_id);
     $subject = $this->_data->get_option('eab_rsvps-email_me-subject');
     $body = $this->_data->get_option('eab_rsvps-email_me-body');
     $admin_email = get_option('admin_email');
     if (empty($subject) || empty($body)) {
         return false;
     }
     $headers = array('Content-Type: ' . $this->email_charset() . '; charset="' . get_option('blog_charset') . '"');
     $codec = new Eab_Events_RsvpEmailMe_Codec($event_id, $user_id);
     add_filter('wp_mail_content_type', array($this, 'email_charset'));
     if ($this->_data->get_option('eab_rsvps-email_me-notify_admin')) {
         wp_mail($admin_email, $codec->expand($subject, Eab_Macro_Codec::FILTER_TITLE), $codec->expand($body, Eab_Macro_Codec::FILTER_BODY), $headers);
     }
     if ($this->_data->get_option('eab_rsvps-email_me-notify_author')) {
         $event = new Eab_EventModel(get_post($event_id));
         $author_id = $event->get_author();
         if ($author_id) {
             $author = get_user_by('id', $author_id);
             if ($author->user_email != $admin_email) {
                 wp_mail($author->user_email, $codec->expand($subject, Eab_Macro_Codec::FILTER_TITLE), $codec->expand($body, Eab_Macro_Codec::FILTER_BODY), $headers);
             }
         }
     }
     remove_filter('wp_mail_content_type', array($this, 'email_charset'));
 }