bp_blogs_record_activity_on_site_creation( BP_Blogs_Blog $recorded_blog, bool $is_private, bool $is_recorded,  $no_activity )

Add an activity entry for a newly-created site.

Description

Hooked to the ‘bp_blogs_new_blog’ action.

Parameters

$recorded_blog

(Required) Current site being recorded. Passed by reference.

$is_private

(Required) Whether the current site being recorded is private.

$is_recorded

(Required) Whether the current site was recorded.

Source

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

function bp_blogs_record_activity_on_site_creation( $recorded_blog, $is_private, $is_recorded, $no_activity ) {
	// Only record this activity if the blog is public.
	if ( ! $is_private && ! $no_activity && bp_blogs_is_blog_trackable( $recorded_blog->blog_id, $recorded_blog->user_id ) ) {
		bp_blogs_record_activity( array(
			'user_id'      => $recorded_blog->user_id,

			/**
			 * Filters the activity created blog primary link.
			 *
			 * @since BuddyPress 1.1.0
			 *
			 * @param string $value Blog primary link.
			 * @param int    $value Blog ID.
			 */
			'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', bp_blogs_get_blogmeta( $recorded_blog->blog_id, 'url' ), $recorded_blog->blog_id ),
			'type'         => 'new_blog',
			'item_id'      => $recorded_blog->blog_id
		) );
	}
}

Changelog

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