bp_get_activity_parent_content

Return the activity content.

Description

bp_get_activity_parent_content( (string) $args = '' ); 

Parameters (1)

0. $args — Optional. (string) => ''
Unused. Left over from an earlier implementation.

Usage

  1. if ( !function_exists( 'bp_get_activity_parent_content' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-template.php'; 
  3.  
  4. // Unused. Left over from an earlier implementation. 
  5. $args = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_get_activity_parent_content($args); 
  9.  

Defined (1)

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

/bp-activity/bp-activity-template.php  
  1. function bp_get_activity_parent_content( $args = '' ) { 
  2. global $activities_template; 
  3.  
  4. // Bail if no activity on no item ID. 
  5. if ( empty( $activities_template->activity ) || empty( $activities_template->activity->item_id ) ) { 
  6. return false; 
  7.  
  8. // Get the ID of the parent activity content. 
  9. $parent_id = $activities_template->activity->item_id; 
  10.  
  11. // Bail if no parent content. 
  12. if ( empty( $activities_template->activity_parents[ $parent_id ] ) ) { 
  13. return false; 
  14.  
  15. // Bail if no action. 
  16. if ( empty( $activities_template->activity_parents[ $parent_id ]->action ) ) { 
  17. return false; 
  18.  
  19. // Content always includes action. 
  20. $content = $activities_template->activity_parents[ $parent_id ]->action; 
  21.  
  22. // Maybe append activity content, if it exists. 
  23. if ( ! empty( $activities_template->activity_parents[ $parent_id ]->content ) ) { 
  24. $content .= ' ' . $activities_template->activity_parents[ $parent_id ]->content; 
  25.  
  26. // Remove the time since content for backwards compatibility. 
  27. $content = str_replace( '<span class="time-since">%s</span>', '', $content ); 
  28.  
  29. // Remove images. 
  30. $content = preg_replace( '/<img[^>]*>/Ui', '', $content ); 
  31.  
  32. /** 
  33. * Filters the activity parent content. 
  34. * @since 1.2.0 
  35. * @param string $content Content set to be displayed as parent content. 
  36. */