Skip to content

Instantly share code, notes, and snippets.

@paulgibbs
Created February 21, 2015 22:28
Show Gist options
  • Save paulgibbs/93a9f66abc07037732da to your computer and use it in GitHub Desktop.
Save paulgibbs/93a9f66abc07037732da to your computer and use it in GitHub Desktop.
diff --git a/src/bp-activity/bp-activity-functions.php b/src/bp-activity/bp-activity-functions.php
index 67c13ec..7cb8e82 100644
--- a/src/bp-activity/bp-activity-functions.php
+++ b/src/bp-activity/bp-activity-functions.php
@@ -1717,17 +1717,7 @@ function bp_activity_post_update( $args = '' ) {
}
// Record this on the user's profile
- $activity_content = $r['content'];
- $primary_link = bp_core_get_userlink( $r['user_id'], false, true );
-
- /**
- * Filters the new activity content for current activity item.
- *
- * @since BuddyPress (1.2.0)
- *
- * @param string $activity_content Activity content posted by user.
- */
- $add_content = apply_filters( 'bp_activity_new_update_content', $activity_content );
+ $primary_link = bp_core_get_userlink( $r['user_id'], false, true );
/**
* Filters the activity primary link for current activity item.
@@ -1739,13 +1729,28 @@ function bp_activity_post_update( $args = '' ) {
$add_primary_link = apply_filters( 'bp_activity_new_update_primary_link', $primary_link );
// Now write the values
- $activity_id = bp_activity_add( array(
+ $activity_args = array(
'user_id' => $r['user_id'],
- 'content' => $add_content,
+ 'content' => $r['content'],
'primary_link' => $add_primary_link,
'component' => buddypress()->activity->id,
'type' => 'activity_update',
- ) );
+ );
+
+ /**
+ * Filters the new activity content for current activity item.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param string $activity_content Generated summary of the activity content posted by the user.
+ * @param string $activity_content Original activity content posted by the user.
+ */
+ $activity_args['content'] = apply_filters( 'bp_activity_new_update_content',
+ bp_activity_create_summary( $r['content'], $activity_args ),
+ $r['content']
+ );
+
+ $activity_id = bp_activity_add( $activity_args );
/**
* Filters the latest update content for the activity item.
@@ -1755,7 +1760,7 @@ function bp_activity_post_update( $args = '' ) {
* @param string $r Content of the activity update.
* @param string $activity_content Content of the activity update.
*/
- $activity_content = apply_filters( 'bp_activity_latest_update_content', $r['content'], $activity_content );
+ $activity_content = apply_filters( 'bp_activity_latest_update_content', $activity_args['content'], $r['content'] );
// Add this update to the "latest update" usermeta so it can be fetched anywhere.
bp_update_user_meta( bp_loggedin_user_id(), 'bp_latest_update', array(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment