Changeset 7334
- Timestamp:
- 08/02/2013 06:29:06 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-classes.php
r7311 r7334 778 778 $this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'alt' => sprintf( __( 'Avatar of %s', 'buddypress' ), $this->fullname ) ) ); 779 779 $this->avatar_mini = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'alt' => sprintf( __( 'Avatar of %s', 'buddypress' ), $this->fullname ), 'width' => 30, 'height' => 30 ) ); 780 $this->last_active = bp_core_get_last_activity( bp_get_user_ meta( $this->id, 'last_activity', true), __( 'active %s', 'buddypress' ) );780 $this->last_active = bp_core_get_last_activity( bp_get_user_last_activity( $this->id ), __( 'active %s', 'buddypress' ) ); 781 781 } 782 782 -
trunk/bp-core/bp-core-functions.php
r7260 r7334 835 835 return false; 836 836 837 $activity = bp_get_user_ meta( $user_id, 'last_activity', true);837 $activity = bp_get_user_last_activity( $user_id ); 838 838 839 839 if ( !is_numeric( $activity ) ) … … 848 848 } 849 849 850 if ( empty( $activity ) || strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) ) 851 bp_update_user_meta( $user_id, 'last_activity', $current_time ); 850 if ( empty( $activity ) || strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) ) { 851 bp_update_user_last_activity( $user_id, $current_time ); 852 } 852 853 } 853 854 add_action( 'wp_head', 'bp_core_record_activity' ); -
trunk/bp-members/bp-members-functions.php
r7228 r7334 806 806 // Return the inverse of active 807 807 return !bp_is_user_active( $user_id ); 808 } 809 810 /** 811 * Update a user's last activity 812 * 813 * @since BuddyPress (1.9) 814 * @param int $user_id ID of the user being updated 815 * @param string $time Time of last activity, in 'Y-m-d H:i:s' format 816 * @return bool True on success 817 */ 818 function bp_update_user_last_activity( $user_id = 0, $time = '' ) { 819 // Fall back on current user 820 if ( empty( $user_id ) ) { 821 $user_id = bp_loggedin_user_id(); 822 } 823 824 // Bail if the user id is 0, as there's nothing to update 825 if ( empty( $user_id ) ) { 826 return false; 827 } 828 829 // Fall back on current time 830 if ( empty( $time ) ) { 831 $time = bp_core_current_time(); 832 } 833 834 return bp_update_user_meta( $user_id, 'last_activity', $time ); 835 } 836 837 /** 838 * Get the last activity for a given user 839 * 840 * @param int $user_id The ID of the user 841 * @return string Time of last activity, in 'Y-m-d H:i:s' format, or an empty 842 * string if none is found 843 */ 844 function bp_get_user_last_activity( $user_id = 0 ) { 845 // Fall back on current user 846 if ( empty( $user_id ) ) { 847 $user_id = bp_loggedin_user_id(); 848 } 849 850 $activity = bp_get_user_meta( $user_id, 'last_activity', true ); 851 852 return apply_filters( 'bp_get_user_last_activity', $activity, $user_id ); 808 853 } 809 854 … … 1514 1559 add_action( 'login_head', 'wp_shake_js', 12 ); 1515 1560 } 1516 add_action( 'login_form_bp-spam', 'bp_live_spammer_login_error' ); 1561 add_action( 'login_form_bp-spam', 'bp_live_spammer_login_error' ); -
trunk/bp-members/bp-members-template.php
r7328 r7334 869 869 $user_id = bp_displayed_user_id(); 870 870 871 $last_activity = bp_core_get_last_activity( bp_get_user_ meta( $user_id, 'last_activity', true), __('active %s', 'buddypress') );871 $last_activity = bp_core_get_last_activity( bp_get_user_last_activity( $user_id ), __('active %s', 'buddypress') ); 872 872 873 873 return apply_filters( 'bp_get_last_activity', $last_activity ); -
trunk/bp-messages/bp-messages-classes.php
r7311 r7334 479 479 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) ); 480 480 481 bp_update_user_ meta( bp_loggedin_user_id(), 'last_activity', bp_core_current_time() );481 bp_update_user_last_activity( bp_loggedin_user_id(), bp_core_current_time() ); 482 482 483 483 do_action_ref_array( 'messages_notice_after_save', array( &$this ) ); -
trunk/tests/includes/testcase.php
r7237 r7334 214 214 $user_id = $this->factory->user->create( $args ); 215 215 216 update_user_meta( $user_id, 'last_activity', $last_activity );216 bp_update_user_last_activity( $user_id, $last_activity ); 217 217 218 218 if ( bp_is_active( 'xprofile' ) ) {
Note: See TracChangeset
for help on using the changeset viewer.