bp_blogs_format_activity_action_new_blog( string $action, object $activity )

Format ‘new_blog’ activity actions.


Parameters Parameters

$action

(string) (Required) Static activity action.

$activity

(object) (Required) Activity data object.


Top ↑

Return Return

(string)


Source Source

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

function bp_blogs_format_activity_action_new_blog( $action, $activity ) {
	$blog_url  = bp_blogs_get_blogmeta( $activity->item_id, 'url' );
	$blog_name = bp_blogs_get_blogmeta( $activity->item_id, 'name' );

	$action = sprintf(
		/* translators: 1: the activity user link. 2: the blog link. */
		esc_html__( '%1$s created the site %2$s', 'buddypress' ),
		bp_core_get_userlink( $activity->user_id ),
		'<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>'
	);

	// Legacy filter - requires the BP_Blogs_Blog object.
	if ( has_filter( 'bp_blogs_activity_created_blog_action' ) ) {
		$user_blog = BP_Blogs_Blog::get_user_blog( $activity->user_id, $activity->item_id );
		if ( $user_blog ) {
			$recorded_blog = new BP_Blogs_Blog( $user_blog );
		}

		if ( isset( $recorded_blog ) ) {
			$action = apply_filters( 'bp_blogs_activity_created_blog_action', $action, $recorded_blog, $blog_name, bp_blogs_get_blogmeta( $activity->item_id, 'description' ) );
		}
	}

	/**
	 * Filters the new blog activity action for the new blog.
	 *
	 * @since 2.0.0
	 *
	 * @param string $action   Constructed activity action.
	 * @param object $activity Activity data object.
	 */
	return apply_filters( 'bp_blogs_format_activity_action_new_blog', $action, $activity );
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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