Ticket #5392: bp-blogs-template.php.patch
File bp-blogs-template.php.patch, 3.6 KB (added by , 10 years ago) |
---|
-
bp-blogs/bp-blogs-template.php
618 618 619 619 /** 620 620 * Output the last active date of the current blog in the loop. 621 * 622 * @param array $args See {@link bp_get_blog_last_active()}. 621 623 */ 622 function bp_blog_last_active( ) {623 echo bp_get_blog_last_active();624 function bp_blog_last_active( $args = array () ) { 625 echo bp_get_blog_last_active( $args ) ; 624 626 } 627 625 628 /** 626 629 * Return the last active date of the current blog in the loop. 627 630 * 631 * @param array $args { 632 * Array of optional arguments. 633 * @type bool $active_format If true, formatted "Active 5 minutes 634 * ago". If false, formatted "5 minutes ago". Default: true. 635 * } 628 636 * @return string Last active date. 629 637 */ 630 function bp_get_blog_last_active( ) {631 global $blogs_template ;638 function bp_get_blog_last_active( $args = array () ) { 639 global $blogs_template ; 632 640 633 return apply_filters( 'bp_blog_last_active', bp_core_get_last_activity( $blogs_template->blog->last_activity, __( 'active %s', 'buddypress' ) ) ); 641 $r = wp_parse_args( $args , array ( 642 'active_format' => true , 643 ) ) ; 644 645 if ( isset( $blogs_template->blog->last_activity ) ) { 646 if ( ! empty( $r[ 'active_format' ] ) ) { 647 $last_activity = bp_core_get_last_activity( $blogs_template->blog->last_activity , __( 'active %s' , 'buddypress' ) ) ; 648 } else { 649 $last_activity = bp_core_time_since( $blogs_template->blog->last_activity ) ; 650 } 651 } else { 652 $last_activity = __( 'Never active' , 'buddypress' ) ; 653 } 654 655 return apply_filters( 'bp_blog_last_active' , $last_activity ) ; 634 656 } 635 657 636 658 /** 637 659 * Output the latest post from the current blog in the loop. 660 * 661 * @param array $args See {@link bp_get_blog_latest_post()}. 638 662 */ 639 function bp_blog_latest_post( ) {640 echo bp_get_blog_latest_post();663 function bp_blog_latest_post( $args = array () ) { 664 echo bp_get_blog_latest_post( $args ) ; 641 665 } 666 642 667 /** 643 668 * Return the latest post from the current blog in the loop. 644 669 * 645 * @return string $retval String of the form 'Latest Post: [link to post]'. 670 * @param array $args { 671 * Array of optional arguments. 672 * @type bool $latest_format If true, formatted "Latest Post: [link 673 * to post]". If false, formatted "[link to post]". Default: true. 674 * } 675 * @return string $retval String of the form 'Latest Post: [link to post]' or '[link to post]'. 646 676 */ 647 function bp_get_blog_latest_post( ) {648 global $blogs_template ;677 function bp_get_blog_latest_post( $args = array () ) { 678 global $blogs_template ; 649 679 650 $retval = bp_get_blog_latest_post_title(); 680 $r = wp_parse_args( $args , array ( 681 'latest_format' => true , 682 ) ) ; 651 683 652 if ( ! empty( $retval ) ) 653 $retval = sprintf( __( 'Latest Post: %s', 'buddypress' ), '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>' ); 684 $retval = bp_get_blog_latest_post_title() ; 654 685 655 return apply_filters( 'bp_get_blog_latest_post', $retval ); 686 if ( ! empty( $retval ) ) { 687 if ( ! empty( $r[ 'latest_format' ] ) ) { 688 $retval = sprintf( __( 'Latest Post: %s' , 'buddypress' ) , '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title' , $retval ) . '</a>' ) ; 689 } else { 690 $retval = '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title' , $retval ) . '</a>' ; 691 } 692 } 693 return apply_filters( 'bp_get_blog_latest_post' , $retval ) ; 656 694 } 657 658 695 /** 659 696 * Output the title of the latest post on the current blog in the loop. 660 697 *