MDL-13179 - avoid calling get_admin() when unecessary.

It uses a relatively complex query and its not needed except
for a minority of users so we may as well avoid it..
merged from MOODLE_19_STABLE
This commit is contained in:
poltawski
2008-01-26 17:00:03 +00:00
parent 29ee92888b
commit fc4b2decc0
5 changed files with 23 additions and 12 deletions
+16
View File
@@ -7865,5 +7865,21 @@ function get_plugin_name($plugin, $type='mod') {
return $plugin_name;
}
/**
* Is a userid the primary administrator?
*
* @param $userid int id of user to check
* @return boolean
*/
function is_primary_admin($userid){
$primaryadmin = get_admin();
if($userid == $primaryadmin->id){
return true;
}else{
return false;
}
}
// vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
?>