Minor - format code, use api_get_user_id()

pull/2487/head
jmontoyaa 8 years ago
parent 2bc3f226e4
commit 2ab2f84d45
  1. 9
      whoisonline.php

@ -19,10 +19,12 @@ $this_section = SECTION_SOCIAL;
$social_right_content = ''; $social_right_content = '';
$whoisonline_list = ''; $whoisonline_list = '';
$social_search = ''; $social_search = '';
$userId = api_get_user_id();
// This if statement prevents users accessing the who's online feature when it has been disabled. // This if statement prevents users accessing the who's online feature when it has been disabled.
if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) || if ((api_get_setting('showonline', 'world') == 'true' && !$userId) ||
((api_get_setting('showonline', 'users') == 'true' || api_get_setting('showonline', 'course') == 'true') && $_user['user_id']) ((api_get_setting('showonline', 'users') == 'true' ||
api_get_setting('showonline', 'course') == 'true') && $userId)
) { ) {
if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) { if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
$user_list = who_is_online_in_this_course( $user_list = who_is_online_in_this_course(
@ -59,8 +61,7 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
} }
} }
} else { } else {
api_not_allowed(); api_not_allowed(true);
exit;
} }
$tpl = new Template(get_lang('UsersOnLineList')); $tpl = new Template(get_lang('UsersOnLineList'));

Loading…
Cancel
Save