bp_get_blog_last_active

Return the last active date of the current blog in the loop.

Description

(string) bp_get_blog_last_active( (array) $args = array() ); 

Returns (string)

Last active date.

Parameters (1)

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

Options

    ;        


    Usage

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

    Defined (1)

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

    /bp-blogs/bp-blogs-template.php  
    1. function bp_get_blog_last_active( $args = array() ) { 
    2. global $blogs_template; 
    3.  
    4. // Parse the activity format. 
    5. $r = bp_parse_args( $args, array( 
    6. 'active_format' => true 
    7. ) ); 
    8.  
    9. // Backwards compatibility for anyone forcing a 'true' active_format. 
    10. if ( true === $r['active_format'] ) { 
    11. $r['active_format'] = __( 'active %s', buddypress ); 
    12.  
    13. // Blog has been posted to at least once. 
    14. if ( isset( $blogs_template->blog->last_activity ) ) { 
    15.  
    16. // Backwards compatibility for pre 1.5 'ago' strings. 
    17. $last_activity = ! empty( $r['active_format'] ) 
    18. ? bp_core_get_last_activity( $blogs_template->blog->last_activity, $r['active_format'] ) 
    19. : bp_core_time_since( $blogs_template->blog->last_activity ); 
    20.  
    21. // Blog has never been posted to. 
    22. } else { 
    23. $last_activity = __( 'Never active', buddypress ); 
    24.  
    25. /** 
    26. * Filters the last active date of the current blog in the loop. 
    27. * @since 1.2.0 
    28. * @param string $last_activity Last active date. 
    29. * @param array $r Array of parsed args used to determine formatting. 
    30. */ 
    31. return apply_filters( 'bp_blog_last_active', $last_activity, $r );