bp_get_group_last_active

Return the 'last active' string for the current group in the loop.

Description

(string) bp_get_group_last_active( (constant) $group = false, (array) $args = array() ); 

Returns (string)

Parameters (2)

0. $group — Optional. (constant) => false
Group object. Default: current group in loop.
1. $args — Optional. (array) => array()
Array of optional parameters.

Options

    ;        


    Usage

    1. if ( !function_exists( 'bp_get_group_last_active' ) ) { 
    2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-groups/bp-groups-template.php'; 
    3.  
    4. // Optional. Group object. Default: current group in loop. 
    5. $group = false; 
    6.  
    7. // Array of optional parameters. 
    8. $args = array(); 
    9.  
    10. // NOTICE! Understand what this does before running. 
    11. $result = bp_get_group_last_active($group, $args); 
    12.  

    Defined (1)

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

    /bp-groups/bp-groups-template.php  
    1. function bp_get_group_last_active( $group = false, $args = array() ) { 
    2. global $groups_template; 
    3.  
    4. if ( empty( $group ) ) { 
    5. $group =& $groups_template->group; 
    6.  
    7. $r = wp_parse_args( $args, array( 
    8. 'relative' => true,  
    9. ) ); 
    10.  
    11. $last_active = $group->last_activity; 
    12. if ( ! $last_active ) { 
    13. $last_active = groups_get_groupmeta( $group->id, 'last_activity' ); 
    14.  
    15. // We do not want relative time, so return now. 
    16. // @todo Should the 'bp_get_group_last_active' filter be applied here? 
    17. if ( ! $r['relative'] ) { 
    18. return esc_attr( $last_active ); 
    19.  
    20. if ( empty( $last_active ) ) { 
    21. return __( 'not yet active', buddypress ); 
    22. } else { 
    23.  
    24. /** 
    25. * Filters the 'last active' string for the current group in the loop. 
    26. * @since 1.0.0 
    27. * @since 2.5.0 Added the `$group` parameter. 
    28. * @param string $value Determined last active value for the current group. 
    29. * @param object $group Group object. 
    30. */ 
    31. return apply_filters( 'bp_get_group_last_active', bp_core_time_since( $last_active ), $group );