Skip to content

Commit

Permalink
Add some content to event creation activity items.
Browse files Browse the repository at this point in the history
  • Loading branch information
boonebgorges committed Mar 22, 2018
1 parent 7de4c9c commit f0f3849
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions includes/activity.php
Expand Up @@ -37,6 +37,27 @@ function bpeo_create_activity_for_event( $event_id, $event = null, $update = nul
$type = 'bpeo_edit_event';
}

$content = '';
if ( 'bpeo_create_event' === $type ) {
$content_parts = array();

$content_parts[] = sprintf( __( 'Title: %s', 'bp-event-organiser' ), $event->post_title );

$date = eo_get_next_occurrence( eo_get_event_datetime_format( $event_id ), $event_id );
if ( $date ) {
$content_parts[] = sprintf( __( 'Date: %s', 'bp-event-organiser' ), esc_html( $date ) );
}

$venue_id = eo_get_venue( $event_id );
if ( $venue_id ) {
$venue = eo_get_venue_name( $venue_id );
$content_parts[] = sprintf( __( 'Location: %s', 'bp-event-organiser' ), esc_html( $venue ) );
}

$content = implode( "\n\r", $content_parts );
}


// Existing activity items for this event.
$activities = bpeo_get_activity_by_event_id( $event_id );

Expand Down Expand Up @@ -90,6 +111,7 @@ function bpeo_create_activity_for_event( $event_id, $event = null, $update = nul
$activity_args = array(
'component' => 'events',
'type' => $type,
'content' => $content,
'user_id' => $event->post_author, // @todo Event edited by non-author?
'primary_link' => get_permalink( $event ),
'secondary_item_id' => $event_id, // Leave 'item_id' blank for groups.
Expand Down

0 comments on commit f0f3849

Please sign in to comment.