Changeset 8407
- Timestamp:
- 05/10/2014 01:13:22 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 edited
-
src/bp-blogs/bp-blogs-template.php (modified) (1 diff)
-
tests/phpunit/testcases/blogs/template.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-template.php
r8142 r8407 634 634 /** 635 635 * Output the last active date of the current blog in the loop. 636 */ 637 function bp_blog_last_active() { 638 echo bp_get_blog_last_active(); 636 * 637 * @param array $args See {@link bp_get_blog_last_active()}. 638 */ 639 function bp_blog_last_active( $args = array() ) { 640 echo bp_get_blog_last_active( $args ); 639 641 } 640 642 /** 641 643 * Return the last active date of the current blog in the loop. 642 644 * 645 * @param array $args { 646 * Array of optional arguments. 647 * @type bool $active_format If true, formatted "Active 5 minutes 648 * ago". If false, formatted "5 minutes ago". Default: true. 649 * } 643 650 * @return string Last active date. 644 651 */ 645 function bp_get_blog_last_active( ) {652 function bp_get_blog_last_active( $args = array() ) { 646 653 global $blogs_template; 647 654 648 return apply_filters( 'bp_blog_last_active', bp_core_get_last_activity( $blogs_template->blog->last_activity, __( 'active %s', 'buddypress' ) ) ); 655 $r = wp_parse_args( $args, array( 656 'active_format' => true, 657 ) ); 658 659 if ( isset( $blogs_template->blog->last_activity ) ) { 660 if ( ! empty( $r['active_format'] ) ) { 661 $last_activity = bp_core_get_last_activity( $blogs_template->blog->last_activity, __( 'active %s', 'buddypress' ) ); 662 } else { 663 $last_activity = bp_core_time_since( $blogs_template->blog->last_activity ); 664 } 665 } else { 666 $last_activity = __( 'Never active', 'buddypress' ); 667 } 668 669 return apply_filters( 'bp_blog_last_active', $last_activity, $r ); 649 670 } 650 671
Note: See TracChangeset
for help on using the changeset viewer.