bp_blogs_format_activity_action_new_blog

Format 'new_blog' activity actions.

Description

(string) bp_blogs_format_activity_action_new_blog( (string) $action, (object) $activity ); 

Returns (string)

Parameters (2)

0. $action (string)
Static activity action.
1. $activity (object)
Activity data object.

Usage

  1. if ( !function_exists( 'bp_blogs_format_activity_action_new_blog' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-activity.php'; 
  3.  
  4. // Static activity action. 
  5. $action = ''; 
  6.  
  7. // Activity data object. 
  8. $activity = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_blogs_format_activity_action_new_blog($action, $activity); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-blogs/bp-blogs-activity.php  
  1. function bp_blogs_format_activity_action_new_blog( $action, $activity ) { 
  2. $blog_url = bp_blogs_get_blogmeta( $activity->item_id, 'url' ); 
  3. $blog_name = bp_blogs_get_blogmeta( $activity->item_id, 'name' ); 
  4.  
  5. $action = sprintf( __( '%s created the site %s', buddypress ), bp_core_get_userlink( $activity->user_id ), '<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>' ); 
  6.  
  7. // Legacy filter - requires the BP_Blogs_Blog object. 
  8. if ( has_filter( 'bp_blogs_activity_created_blog_action' ) ) { 
  9. $user_blog = BP_Blogs_Blog::get_user_blog( $activity->user_id, $activity->item_id ); 
  10. if ( $user_blog ) { 
  11. $recorded_blog = new BP_Blogs_Blog( $user_blog ); 
  12.  
  13. if ( isset( $recorded_blog ) ) { 
  14. $action = apply_filters( 'bp_blogs_activity_created_blog_action', $action, $recorded_blog, $blog_name, bp_blogs_get_blogmeta( $activity->item_id, 'description' ) ); 
  15.  
  16. /** 
  17. * Filters the new blog activity action for the new blog. 
  18. * @since 2.0.0 
  19. * @param string $action Constructed activity action. 
  20. * @param object $activity Activity data object. 
  21. */