Changeset 7846 for trunk/bp-members/bp-members-template.php
- Timestamp:
- 02/11/2014 03:19:01 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-members/bp-members-template.php
r7756 r7846 587 587 add_filter( 'bp_get_member_name', 'esc_html' ); 588 588 589 function bp_member_last_active() { 590 echo bp_get_member_last_active(); 591 } 592 function bp_get_member_last_active() { 593 global $members_template; 594 595 if ( isset( $members_template->member->last_activity ) ) 596 $last_activity = bp_core_get_last_activity( $members_template->member->last_activity, __( 'active %s', 'buddypress' ) ); 597 else 589 /** 590 * Output the current member's last active time. 591 * 592 * @param array $args See {@link bp_get_member_last_active()}. 593 */ 594 function bp_member_last_active( $args = array() ) { 595 echo bp_get_member_last_active( $args ); 596 } 597 /** 598 * Return the current member's last active time. 599 * 600 * @param array $args { 601 * Array of optional arguments. 602 * @type bool $active_format If true, formatted "Active 5 minutes 603 * ago". If false, formatted "5 minutes ago". Default: true. 604 * } 605 * @return string 606 */ 607 function bp_get_member_last_active( $args = array() ) { 608 global $members_template; 609 610 $r = wp_parse_args( $args, array( 611 'active_format' => true, 612 ) ); 613 614 if ( isset( $members_template->member->last_activity ) ) { 615 if ( ! empty( $r['active_format'] ) ) { 616 $last_activity = bp_core_get_last_activity( $members_template->member->last_activity, __( 'active %s', 'buddypress' ) ); 617 } else { 618 $last_activity = bp_core_time_since( $members_template->member->last_activity ); 619 } 620 } else { 598 621 $last_activity = __( 'Never active', 'buddypress' ); 622 } 599 623 600 624 return apply_filters( 'bp_member_last_active', $last_activity );
Note: See TracChangeset
for help on using the changeset viewer.