bp_get_member_latest_update

Get the latest update from the current member in the loop.

Description

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

Returns (string)

Parameters (1)

0. $args — Optional. (string) => ''
Array of optional arguments.

Options

  • length (int) => 0

    Truncation length. Default: 225.

array(

    /**
     * Truncation length. Default: 225.
     *
     * @type int
     */
    'length' => 0
);        


Usage

  1. if ( !function_exists( 'bp_get_member_latest_update' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-members/bp-members-template.php'; 
  3.  
  4. // Array of optional arguments. 
  5. $args = array( 
  6. 'length' => 0 
  7. ); 
  8.  
  9. // NOTICE! Understand what this does before running. 
  10. $result = bp_get_member_latest_update($args); 
  11.  

Defined (1)

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

/bp-members/bp-members-template.php  
  1. function bp_get_member_latest_update( $args = '' ) { 
  2. global $members_template; 
  3.  
  4. $defaults = array( 
  5. 'length' => 225,  
  6. 'view_link' => true 
  7. ); 
  8.  
  9. $r = wp_parse_args( $args, $defaults ); 
  10. extract( $r ); 
  11.  
  12. if ( !bp_is_active( 'activity' ) || empty( $members_template->member->latest_update ) || !$update = maybe_unserialize( $members_template->member->latest_update ) ) 
  13. return false; 
  14.  
  15. /** 
  16. * Filters the excerpt of the latest update for current member in the loop. 
  17. * @since 1.2.5 
  18. * @since 2.6.0 Added the `$r` parameter. 
  19. * @param string $value Excerpt of the latest update for current member in the loop. 
  20. * @param array $r Array of parsed arguments. 
  21. */ 
  22. $update_content = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], $length ) ) ), $r ); 
  23.  
  24. $update_content = sprintf( _x( '- "%s"', 'member latest update in member directory', buddypress ), $update_content ); 
  25.  
  26. // If $view_link is true and the text returned by bp_create_excerpt() is different from the original text (ie it's 
  27. // been truncated), add the "View" link. 
  28. if ( $view_link && ( $update_content != $update['content'] ) ) { 
  29. $view = __( 'View', buddypress ); 
  30.  
  31. $update_content .= '<span class="activity-read-more"><a href="' . bp_activity_get_permalink( $update['id'] ) . '" rel="nofollow">' . $view . '</a></span>'; 
  32.  
  33. /** 
  34. * Filters the latest update from the current member in the loop. 
  35. * @since 1.2.0 
  36. * @since 2.6.0 Added the `$r` parameter. 
  37. * @param string $update_content Formatted latest update for current member. 
  38. * @param array $r Array of parsed arguments. 
  39. */ 
  40. return apply_filters( 'bp_get_member_latest_update', $update_content, $r );