Usage
PHP
nebula()->is_user_online($id)
Parameters
$id
(Required) (Integer) The user ID to check
Default: None
Source File
Located in /libs/Admin/Users.php on line 182.
1 Hook
Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.
Filters
"pre_nebula_is_user_online"Need a new filter hook? Request one here.
Actions
This function has no action hooks available. Request one?
PHP
public function is_user_online($id){
$override = apply_filters('pre_nebula_is_user_online', null, $id);
if ( isset($override) ){return;}
$logged_in_users = $this->get_data('users_status');
return isset($logged_in_users[$id]['last']) && $logged_in_users[$id]['last'] > time()-600; //10 Minutes
}
Override
To override this PHP function, use this hook in your child theme or plugin ("my_custom" can be changed):
PHP
add_filter('pre_nebula_is_user_online', 'my_custom_is_user_online', 10, 2); //The last integer must be 1 more than the actual parameters
function my_custom_is_user_online($null, $id){ //$null is required, but can be ignored
//Write your own code here
return true; //Return true to prevent the original function from running afterwords
}
You can completely disable this PHP function with a single line actions:
PHP
add_filter('pre_nebula_is_user_online', '__return_false');