friends_record_activity( array|string $args = '' )

Record an activity item related to the Connections component.

Description

A wrapper for bp_activity_add() that provides some Connections-specific defaults.

See also

Parameters

$args

(Optional) An array of arguments for the new activity item. Accepts all parameters of bp_activity_add(). The one difference is the following argument, which has a different default here:

  • 'component'
    (string) Default: the id of your Connections component (usually 'friends').

Default value: ''

Return

(WP_Error|bool|int) See bp_activity_add().

Source

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

function friends_record_activity( $args = '' ) {

	if ( ! bp_is_active( 'activity' ) ) {
		return false;
	}

	$r = wp_parse_args( $args, array(
		'user_id'           => bp_loggedin_user_id(),
		'action'            => '',
		'content'           => '',
		'primary_link'      => '',
		'component'         => buddypress()->friends->id,
		'type'              => false,
		'item_id'           => false,
		'secondary_item_id' => false,
		'recorded_time'     => bp_core_current_time(),
		'hide_sitewide'     => false
	) );

	return bp_activity_add( $r );
}

Changelog

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