I've taken your idea and have added it as a patch to our reviews system
https://reviews.mahara.org/#/c/7826/1
I made a couple of changes, the main difference is I fetched the user's account theme via the $USER object rather than a SQL query and had the fallback to the default institution 'mahara' rather than the default theme 'raw'
Cheers
Robert
]]>Yes if you want !
I create a simple function (probably it's not the mahara style) :
/**
* Get the theme of the current institution
* @return mixed
*/
function get_current_theme_value()
{
global $USER;
$usrinstval = get_field_sql('SELECT i.name iname
FROM usr_account_preference ui
INNER JOIN institution i
ON CONCAT(i.theme, \'/\', i.name) = ui.value
WHERE ui.usr = ?', array($USER->id));
if(!empty($usrinstval))
{
return $usrinstval;
}
else
{
return 'raw';
}
}
And after in lib/mahara.php in the function progressbar_sideblock I replace the line $institution = key(array_slice($institutions, 0, 1)); with $institution = get_current_theme_value();
]]>
This sounds like a good idea. Do you want to submit it for inclusion into Mahara core?
Cheers
Kristina
]]>
Thank you for your help !
I change the function progressbar_sideblock and it works :
// Set user's first institution in case that institution isn't
// set yet or user is not member of currently set institution.
if (!$institution || !array_key_exists($institution, $institutions)) {
$institution = get_current_theme_value(); // key(array_slice($institutions, 0, 1))
}
In this way the user can sees the current institution as the first institution
]]>I'm not quite sure what you are meaning? Are you taking about the institution selector in the Profile completion sidebar?
If it about that selector then the institution that appears first on the list is the institution that appears first for a user. Currently there is no way to force a particular institution to appear first by default. If you wanted to do this manually then you would need to make a change in the progressbar_sideblock() function.
If the user is in only one institution then they don't see the selector at all.
Or are you meaning something else? if so can you describe the page/place you see it
Cheers
Robert
]]>