Best practice forum (Archived)

This forum discussion has been removed

 
This forum post has been removed
Friday, 13 December 2013, 6:47 AM
The content of this forum post has been removed and can no longer be accessed.
? ?
Re: Upgrade to 2.5 Broke my Logo based on Custom Totara
by ? ? - Sunday, 15 December 2013, 2:37 PM
 

Hi Alan,

I think in 2.5 one of the theme admin settings changed. The 2.4 version for the logo picker in your theme/settings.php would have been something like

$setting = new admin_setting_configfilepicker($name, $title, $description, $default, array('web_image'));

but the 2.5 version is

$setting = new admin_setting_configstoredfile($name, $title, $description, 'logo');

 

Making that change should fix your custom theme, I think.

The Totara menu is defined in totara/core/totara.php in the function totara_build_menu() so that is where you would need to make code changes to add or remove items from the standard menu. There is an outstanding feature request to make the menu fully customisable through a web interface, but it is very unlikely that this will make it into Totara core before 2.6 at the earliest.

This forum post has been removed
Monday, 16 December 2013, 5:03 AM
The content of this forum post has been removed and can no longer be accessed.
? ?
Re: Upgrade to 2.5 Broke my Logo based on Custom Totara
by ? ? - Monday, 16 December 2013, 7:25 PM
 

Hi Alan,

I've gone through all the changes in the base customtotara from 2.4 to 2.5. You are right, there are some code changes. You will probably need to be change all these as well in your 2.5 theme - replace customtotara with the directory your theme is in in all the lines below:

 

/theme/customtotara/config.php change the last line

$THEME->csspostprocess = 'customtotara_process_css';

to

$THEME->csspostprocess = 'theme_customtotara_process_css';

 

theme/customtotara/lib.php, Rename

function customtotara_process_css($css, $theme) {

to

function theme_customtotara_process_css($css, $theme) {

And in that function on the second-last line change

$css = customtotara_set_customcss($css, $customcss); 

to

$css = theme_customtotara_set_customcss($css, $customcss);

 

Still in lib.php, Rename

function customtotara_set_customcss($css, $customcss) {

to

function theme_customtotara_set_customcss($css, $customcss) {

 

Immediately after function theme_customtotara_set_customcss add a new function:

/**
 * Serves any files associated with the theme settings.
 *
 * @param stdClass $course
 * @param stdClass $cm
 * @param context $context
 * @param string $filearea
 * @param array $args
 * @param bool $forcedownload
 * @param array $options
 * @return bool
 */
function theme_customtotara_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
    if ($context->contextlevel == CONTEXT_SYSTEM && ($filearea === 'logo' || $filearea === 'favicon')) {
        $theme = theme_config::load('customtotara');
        return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
    } else {
        send_file_not_found();
    }

 

And lastly, in settings.php where you changed "new admin_setting_configfilepicker" to "new admin_setting_configstoredfile" in my first reply, you should add the line

$setting->set_updatedcallback('theme_reset_all_caches');

This line should also be added after all the $setting = new admin_setting_* lines in that file - 7 of them in the base standardtotara.

 

If all that works then I'll put together instructions for all the clients who may have 2.4 custom themes as I can see this being a problem for quite a few clients.

This forum post has been removed
Tuesday, 17 December 2013, 4:45 AM
The content of this forum post has been removed and can no longer be accessed.
This forum post has been removed
Tuesday, 17 December 2013, 5:11 AM
The content of this forum post has been removed and can no longer be accessed.
This forum post has been removed
Tuesday, 17 December 2013, 9:14 AM
The content of this forum post has been removed and can no longer be accessed.
? ?
Re: Upgrade to 2.5 Broke my Logo based on Custom Totara
by ? ? - Tuesday, 17 December 2013, 12:05 PM
 

Hi Ciaran,

We experienced a similar problem upgrading a stock Totara 2.4 to 2.5, with no customized themes. The upgrade seemed to loose the theme settings made by the admin (in this case colours) and the link to the logo image they uploaded. These had to be reset.

Regards,

Richard

? ?
Re: Upgrade to 2.5 Broke my Logo based on Custom Totara
by ? ? - Tuesday, 17 December 2013, 3:07 PM
 

Hi Richard,

I'm not surprised by the logo, because the way the theme logos are uploaded and stored radically changed in Moodle and I'm not really sure if we can add anything to the upgrade script to migrate the logos properly, though we will look into it.

Other non-file settings like the colours though should definitely have been migrated so there may be a different, if related, bug there.

? ?
Re: Upgrade to 2.5 Broke my Logo based on Custom Totara
by ? ? - Tuesday, 17 December 2013, 3:03 PM
 

Hi Alan,

Did you try turning on debugging to see if there was an error message on the white screen? You should take a clean copy of the old working 2.4 theme from the original 2.4 install, add the theme directory to 2.5, make the changes above (and no others), turn on debugging, and see what happens. You may still have to reset the logo in the theme settings because of the new logo filepicker.

Unfortunately without actually having your custom theme code it's almost impossible to try and diagnose the problem from here. If your theme is mainly just CSS and image changes to the base customtotara then alternatively it should be relatively straightforward to apply those changes on top of a copy of the 2.5 version of customtotara. However if it is a heavily customised theme with lots of custom code then there will probably always be issues with such a theme on every major version upgrade, depending on what changes Moodle have made.

This forum post has been removed
Wednesday, 18 December 2013, 4:40 AM
The content of this forum post has been removed and can no longer be accessed.