friends_record_activity( array|string $args = '' )

Record an activity item related to the Friends component.


Description Description

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

See also See also


Top ↑

Parameters Parameters

$args

(array|string) (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 Friends component (usually 'friends').

Default value: ''


Top ↑

Return Return

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


Top ↑

Source 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 );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.