Changeset 7334 for trunk/bp-members/bp-members-functions.php
- Timestamp:
- 08/02/2013 06:29:06 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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' );
Note: See TracChangeset
for help on using the changeset viewer.