bp_blogs_format_activity_action_new_blog( string $action, object $activity )

Format ‘new_blog’ activity actions.

Description

Parameters

$action

(Required) Static activity action.

$activity

(Required) Activity data object.

Return

(string)

Source

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

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
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( __( '%s created the site %s', 'buddyboss' ), 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 BuddyPress 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 );
}

Changelog

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