Commit 333ab7f0 authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review

Merge "Add LiveUser->get_primary_institution(). Bug 1478374 and fix error of...

Merge "Add LiveUser->get_primary_institution(). Bug 1478374 and fix error of using [] with a function in PHP 5.3"
parents 28621d05 658ed4a4
......@@ -1714,6 +1714,15 @@ class LiveUser extends User {
return $this->defaults[$key];
}
/**
* Gets the primary institution
* @return institution id or 'mahara' if not set
*/
public function get_primary_institution() {
$institutions = array_keys($this->get('institutions'));
return !empty($institutions[0]) ? $institutions[0] : 'mahara';
}
/**
* Sets the property keyed by $key
*/
......
......@@ -2898,7 +2898,7 @@ function main_nav() {
$cachemenu = false;
// Get the first institution
$institution = !empty(array_keys($USER->get('institutions'))[0]) ? array_keys($USER->get('institutions'))[0] : 'mahara';
$institution = $USER->get_primary_institution();
$menutype = '';
if (in_admin_section()) {
global $USER, $SESSION;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment