$content ) ); // Post to groups object. } elseif ( 'groups' == $object && bp_is_active( 'groups' ) ) { if ( (int) $item_id ) { $activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) ); } } else { /** * Filters activity object for BuddyPress core and plugin authors before posting activity update. * * @since 1.2.0 * @since 5.0.0 Fixed filter signature to match other instances of filter, * with $activity_id as the first param. * * @param int $activity_id ID of the activity item. * @param string $object Activity item being associated to. * @param string $item_id Component ID being posted to. * @param string $content Activity content being posted. */ $activity_id = apply_filters( 'bp_activity_custom_update', 0, $object, $item_id, $content ); } // Provide user feedback. if ( !empty( $activity_id ) ) bp_core_add_message( __( 'Update Posted!', 'buddypress' ) ); else bp_core_add_message( __( 'There was an error when posting your update. Please try again.', 'buddypress' ), 'error' ); // Redirect. bp_core_redirect( wp_get_referer() ); } add_action( 'bp_actions', 'bp_activity_action_post_update' );