bp_get_activity_parent_content( string $args = '' )

Return the activity content.

Description

Parameters

$args

(string) (Optional) Unused. Left over from an earlier implementation.

Default value: ''

Return

(mixed) False on failure, otherwise the activity parent content.

Source

File: bp-activity/bp-activity-template.php

	function bp_get_activity_parent_content( $args = '' ) {
		global $activities_template;

		// Bail if no activity on no item ID.
		if ( empty( $activities_template->activity ) || empty( $activities_template->activity->item_id ) ) {
			return false;
		}

		// Get the ID of the parent activity content.
		$parent_id = $activities_template->activity->item_id;

		// Bail if no parent content.
		if ( empty( $activities_template->activity_parents[ $parent_id ] ) ) {
			return false;
		}

		// Bail if no action.
		if ( empty( $activities_template->activity_parents[ $parent_id ]->action ) ) {
			return false;
		}

		// Content always includes action.
		$content = $activities_template->activity_parents[ $parent_id ]->action;

		// Maybe append activity content, if it exists.
		if ( ! empty( $activities_template->activity_parents[ $parent_id ]->content ) ) {
			$content .= ' ' . $activities_template->activity_parents[ $parent_id ]->content;
		}

		// Remove the time since content for backwards compatibility.
		$content = str_replace( '<span class="time-since">%s</span>', '', $content );

		// Remove images.
		$content = preg_replace( '/<img[^>]*>/Ui', '', $content );

		/**
		 * Filters the activity parent content.
		 *
		 * @since BuddyPress 1.2.0
		 *
		 * @param string $content Content set to be displayed as parent content.
		 */
		return apply_filters( 'bp_get_activity_parent_content', $content );
	}

Changelog

Changelog
Version Description
BuddyPress 1.2.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.