Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/04/2011 06:07:33 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Prevent spam and deleted users from updating their last activity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r4587 r4588  
    730730function bp_core_record_activity() {
    731731    global $bp;
    732 
     732   
    733733    if ( !is_user_logged_in() )
    734734        return false;
    735 
    736     $activity = bp_get_user_meta( $bp->loggedin_user->id, 'last_activity', true );
     735   
     736    $user_id = $bp->loggedin_user->id;
     737   
     738    if ( bp_core_is_user_spammer( $user_id ) || bp_core_is_user_deleted( $user_id ) )
     739        return false;
     740
     741    $activity = bp_get_user_meta( $user_id, 'last_activity', true );
    737742
    738743    if ( !is_numeric( $activity ) )
     
    743748
    744749    if ( empty( $activity ) || strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) )
    745         bp_update_user_meta( $bp->loggedin_user->id, 'last_activity', $current_time );
     750        bp_update_user_meta( $user_id, 'last_activity', $current_time );
    746751}
    747752add_action( 'wp_head', 'bp_core_record_activity' );
Note: See TracChangeset for help on using the changeset viewer.