Issue Details (XML | Word | Printable)

Key: MDL-16152
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Eloy Lafuente (stronk7)
Reporter: Ulrich Hauser-Ehninger
Votes: 2
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

reverting to 'do not force' in 'category' -> 'force theme' does not work

Created: 21/Aug/08 03:57 PM   Updated: 02/Sep/08 03:32 PM
Component/s: Themes
Affects Version/s: 1.9.2
Fix Version/s: 1.9.3

File Attachments: 1. File editcategory.php (13 kB)


Participants: Caio SBA, Eloy Lafuente (stronk7), Helen Foster, Ulrich Hauser-Ehninger and Urs Hunkler
Security Level: None
QA Assignee: Helen Foster
Resolved date: 29/Aug/08
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
If a theme is forced in a category and then the setting is reverted to 'do not force', this new setting is not saved, but the forced theme remains in place.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Helen Foster added a comment - 21/Aug/08 06:37 PM
I can confirm this issue.

Forum discussion: http://moodle.org/mod/forum/discuss.php?d=103715


Urs Hunkler added a comment - 21/Aug/08 08:24 PM
That's an issue for another developer.

Caio SBA added a comment - 28/Aug/08 01:15 AM
Hi everyone!

I think i fixed this. It seems to be very simple.
The problem is that when you set the option to be "Do not force" an empty value is set, but in course/editcategory.php, you have this near line 64:

if (!empty($data->theme) && !empty($CFG->allowcategorythemes)) { $newcategory->theme = $data->theme; theme_setup(); }

It's where the theme option for the category is set. But when you set it to "Do not force", an empty value is sent to the script, so it will not match the "if" condition "!empty($data->theme)".
I changed this to "isset($data->theme)", which just verify if the variable has a value (empty or not).
So, with just this modification, we have:

if (isset($data->theme) && !empty($CFG->allowcategorythemes)) { $newcategory->theme = $data->theme; theme_setup(); } }

I tested hard after this modification and it works! Now you can revert to "do not force" and have this working

I attached the modified course/editcategory.php in this issue.

Hope to be useful,

Caio


Caio SBA added a comment - 28/Aug/08 01:16 AM
Fixed!

Eloy Lafuente (stronk7) added a comment - 29/Aug/08 07:16 AM
Fixed in 19_STABLE and HEAD.

Thanks for the proposed change, Caio SBA. Was perfect! B-)

Ciao


Caio SBA added a comment - 29/Aug/08 08:18 PM
Yeah! Happy to be useful
I'll try to help fixing other bugs.

Helen Foster added a comment - 02/Sep/08 03:32 PM
Ulrich, thanks for reporting this issue
Caio, thanks for providing a fix
Eloy, thanks for applying Caio's fix

Tested in 1.9.2+ and found to be working perfectly!