Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/03/2013 02:32:50 AM (11 years ago)
Author:
boonebgorges
Message:

Introduces bp_user_query_online_interval filter

This will allow site admins or plugins to adjust the number of minutes used as
an interval when querying for 'online' users using BP_User_Query.

Fixes #4347

File:
1 edited

Legend:

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

    r7024 r7135  
    199199
    200200            // 'online' query happens against the last_activity usermeta key
     201            // Filter 'bp_user_query_online_interval' to modify the
     202            // number of minutes used as an interval
    201203            case 'online' :
    202204                $this->uid_name = 'user_id';
    203205                $sql['select']  = "SELECT DISTINCT u.{$this->uid_name} as id FROM {$wpdb->usermeta} u";
    204206                $sql['where'][] = $wpdb->prepare( "u.meta_key = %s", bp_get_user_meta_key( 'last_activity' ) );
    205                 $sql['where'][] = 'u.meta_value >= DATE_SUB( UTC_TIMESTAMP(), INTERVAL 5 MINUTE )';
     207                $sql['where'][] = $wpdb->prepare( "u.meta_value >= DATE_SUB( UTC_TIMESTAMP(), INTERVAL %d MINUTE )", apply_filters( 'bp_user_query_online_interval', 15 ) );
    206208                $sql['orderby'] = "ORDER BY u.meta_value";
    207209                $sql['order']   = "DESC";
Note: See TracChangeset for help on using the changeset viewer.