Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Recentally Active


bbrian017
Participant

@bbrian017

ok when I create that file and upload it to /mu-plugins/ I get that exact code displaying in my header

function get_recently_active_users( $limit = null, $page = 1 ) { global $wpdb; if ( $limit && $page ) $pag_sql = $wpdb->prepare( ” LIMIT %d, %d”, intval( ( $page – 1 ) * $limit), intval( $limit ) ); $paged_users = $wpdb->get_results( $wpdb->prepare( “SELECT DISTINCT um.user_id FROM ” . $wpdb->base_prefix . “usermeta um LEFT JOIN ” . $wpdb->base_prefix . “users u ON u.ID = um.user_id WHERE um.meta_key = ‘last_activity’ AND u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND DATE_ADD( FROM_UNIXTIME(um.meta_value), INTERVAL 10 HOUR ) >= NOW() ORDER BY FROM_UNIXTIME(um.meta_value) DESC{$pag_sql}” ) ); return $paged_users; }

Skip to toolbar