bp_activity_get_meta

Get metadata for a given activity item.

Description

bp_activity_get_meta( (int) $activity_id = 0, (string) $meta_key = '', (bool) $single = true ); 

Parameters (3)

0. $activity_id — Optional. (int)
ID of the activity item whose metadata is being requested.
1. $meta_key — Optional. (string) => ''
If present, only the metadata matching that meta key will be returned. Otherwise, all metadata for the activity item will be fetched.
2. $single — Optional. (bool) => true
If true, return only the first value of the specified meta_key. This parameter has no effect if meta_key is not specified. Default: true.

Usage

  1. if ( !function_exists( 'bp_activity_get_meta' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-functions.php'; 
  3.  
  4. // ID of the activity item whose metadata is being requested. 
  5. $activity_id = -1; 
  6. $meta_key = ''; 
  7. $single = true; 
  8.  
  9. // NOTICE! Understand what this does before running. 
  10. $result = bp_activity_get_meta($activity_id, $meta_key, $single); 
  11.  

Defined (1)

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

/bp-activity/bp-activity-functions.php  
  1. function bp_activity_get_meta( $activity_id = 0, $meta_key = '', $single = true ) { 
  2. $retval = get_metadata( 'activity', $activity_id, $meta_key, $single ); 
  3.  
  4. /** 
  5. * Filters the metadata for a specified activity item. 
  6. * @since 1.5.0 
  7. * @param mixed $retval The meta values for the activity item. 
  8. * @param int $activity_id ID of the activity item. 
  9. * @param string $meta_key Meta key for the value being requested. 
  10. * @param bool $single Whether to return one matched meta key row or all. 
  11. */ 
  12. return apply_filters( 'bp_activity_get_meta', $retval, $activity_id, $meta_key, $single );