bp_blogs_publish_post_activity_meta

Record activity metadata about a published blog post.

Description

bp_blogs_publish_post_activity_meta( (int) $activity_id, (WP_Post) $post, (array) $args ); 

Parameters (3)

0. $activity_id (int)
ID of the activity item.
1. $post (WP_Post)
Post object.
2. $args (array)
Array of arguments.

Usage

  1. if ( !function_exists( 'bp_blogs_publish_post_activity_meta' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-functions.php'; 
  3.  
  4. // ID of the activity item. 
  5. $activity_id = -1; 
  6.  
  7. // Post object. 
  8. $post = null; 
  9.  
  10. // Array of arguments. 
  11. $args = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bp_blogs_publish_post_activity_meta($activity_id, $post, $args); 
  15.  

Defined (1)

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

/bp-blogs/bp-blogs-functions.php  
  1. function bp_blogs_publish_post_activity_meta( $activity_id, $post, $args ) { 
  2. if ( empty( $activity_id ) || 'post' != $post->post_type ) { 
  3. return; 
  4.  
  5. bp_activity_update_meta( $activity_id, 'post_title', $post->post_title ); 
  6.  
  7. if ( ! empty( $args['post_url'] ) ) { 
  8. $post_permalink = $args['post_url']; 
  9. } else { 
  10. $post_permalink = $post->guid; 
  11.  
  12. bp_activity_update_meta( $activity_id, 'post_url', $post_permalink ); 
  13.  
  14. // Update the blog's last activity. 
  15. bp_blogs_update_blogmeta( $args['item_id'], 'last_activity', bp_core_current_time() ); 
  16.  
  17. /** 
  18. * Fires after BuddyPress has recorded metadata about a published blog post. 
  19. * @since 1.0.0 
  20. * @param int $ID ID of the blog post being recorded. 
  21. * @param WP_Post $post WP_Post object for the current blog post. 
  22. * @param string $value ID of the user associated with the current blog post. 
  23. */ 
  24. do_action( 'bp_blogs_new_blog_post', $post->ID, $post, $args['user_id'] );