bp_get_activity_parent_user_id()

Return the parent activity’s user ID.

Description

Return

(bool|int) False if parent activity can't be found, otherwise the parent activity's user ID.

Source

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

	function bp_get_activity_parent_user_id() {
		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 item.
		if ( empty( $activities_template->activity_parents[ $parent_id ] ) ) {
			return false;
		}

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

		$retval = $activities_template->activity_parents[ $parent_id ]->user_id;

		/**
		 * Filters the activity parent item's user ID.
		 *
		 * @since BuddyPress 1.7.0
		 *
		 * @param int $retval ID for the activity parent's user.
		 */
		return (int) apply_filters( 'bp_get_activity_parent_user_id', $retval );
	}

Changelog

Changelog
Version Description
BuddyPress 1.7.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.