bp_xprofile_new_avatar_activity( int $user_id )

Adds an activity feed item when a user has uploaded a new avatar.

Description

Parameters

$user_id

(Required) The user id the avatar was set for.

Return

(bool)

Source

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

function bp_xprofile_new_avatar_activity( $user_id = 0 ) {

	// Bail if activity component is not active.
	if ( ! bp_is_active( 'activity' ) ) {
		return false;
	}

	if ( empty( $user_id ) ) {
		$user_id = bp_displayed_user_id();
	}

	/**
	 * Filters the user ID when a user has uploaded a new avatar.
	 *
	 * @since BuddyPress 1.5.0
	 *
	 * @param int $user_id ID of the user the avatar was set for.
	 */
	$user_id = apply_filters( 'bp_xprofile_new_avatar_user_id', $user_id );

	// Add the activity.
	bp_activity_add( array(
		'user_id'   => $user_id,
		'component' => 'profile',
		'type'      => 'new_avatar'
	) );
}

Changelog

Changelog
Version Description
BuddyPress 2.3.4 Add new parameter to get the user id the avatar was set for. BuddyPress 2.3.4 Add new parameter to get the user id the avatar was set for.
BuddyPress 1.0.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.