Issue Details (XML | Word | Printable)

Key: MDL-6926
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Dongsheng Cai
Reporter: Joseph Rézeau
Votes: 0
Watchers: 3
Operations

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

Force language does not override Profile settings in Forum display settings

Created: 12/Oct/06 04:37 PM   Updated: 08/Apr/09 02:37 PM
Return to search
Component/s: Forum, Languages
Affects Version/s: 1.6.1, 1.6.2, 1.6.3, 1.7, 1.8
Fix Version/s: 1.7.7, 1.8.8, 1.9.4

File Attachments: 1. Text File MDL-6926-18.patch (4 kB)
2. Text File MDL-6926-19.patch (4 kB)
3. File MDL-6926_ab.diff (2 kB)
4. File MDL-6926_ab_sq.diff (6 kB)

Image Attachments:

1. screenshot-1.jpg
(60 kB)

Participants: Anthony Borrow, Dongsheng Cai, Eloy Lafuente (stronk7), Joseph Rézeau, Ralf Hilgenstock, Tim Hunt and Yu Zhang
Security Level: None
QA Assignee: Tim Hunt
Resolved date: 08/Apr/09
Affected Branches: MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE
Fixed Branches: MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
Force language parameter in Course Admin settings does *not* override user's personal Profile settings in Forum display settings.
Example:
User's Personal profile Preferred language = French
Course settings: Force language = English
When user views a forum in that course, all the elements in the interface are in English except the drop-down box of forum discussions display settings, which remain in the user's preferred language, i.e. French. See attached screen shot.

Joseph

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Yu Zhang added a comment - 17/Oct/06 12:40 PM
Hi,

I think the problem is that the string definition is loaded before the course, should be fixed now, thanks.


Ralf Hilgenstock added a comment - 10/Jan/09 12:27 AM
The problem came back when require_once("lib.php"); was moved back to the top of discuss.php

http://cvs.moodle.org/moodle/mod/forum/discuss.php?r1=1.85&r2=1.84


Eloy Lafuente (stronk7) added a comment - 10/Jan/09 09:44 PM
Assigning to Dongsheng... can you take a look to this?

Dongsheng Cai added a comment - 12/Jan/09 03:02 PM
This patch is against moodle 1.8.

Also fix the other strings in post page and forum frontpage.


Dongsheng Cai added a comment - 12/Jan/09 03:12 PM
Patch against 1.9

Dongsheng Cai added a comment - 14/Jan/09 02:01 PM
Fixed, please review

Tim Hunt added a comment - 20/Jan/09 01:41 PM
Good fix. Thanks.

Anthony Borrow added a comment - 05/Apr/09 03:57 AM
Dongsheng - I am going to re-open this to address what I think may be a regression. When clicking on the forum name in the navigation bar, I receive the following PHP Notice:

Notice: Undefined variable: strforum in /home/arborrow/Moodle/code/18stable/mod/forum/view.php on line 48)

Looks like we are trying to use it before we define it. It looks like the logic is a little tricky and I think we need an additional if statement. I'm attaching a patch to show you want I'm thinking but I did not test this thoroughly. I simply wanted to show you the change in logic of getting the $cm first, then requiring login, assigning the string values, and then setting the buttontext (unless there is no $cm). Since the require_login requires the $cm we have to set buttontext afterwards.

Peace - Anthony


Anthony Borrow added a comment - 05/Apr/09 03:58 AM
For 18STABLE we now have a PHP notice with the code as it is. Please re-check the logic.

Anthony Borrow added a comment - 05/Apr/09 03:59 AM
Here is the revised logic that I think accomplishes what we are aiming for. Peace - Anthony

Anthony Borrow added a comment - 05/Apr/09 04:07 AM
Here is a second version that also replaces all the get_string statements that were using double quotes with single quotes which I believe is preferred for memory usage. I don't believe the get_string function requires any of the escaped characters so I cannot think of a time when double quotes would be used with get_string except perhaps to pass it a $a with escaped characters. Feel free to ignore this as one of my OCD moments. Peace - Anthony

Anthony Borrow added a comment - 05/Apr/09 04:40 AM
I verified this is not an issue for 1.9 because the buttontext is not set for when there might not be a $cm. I'm not sure why would couldn't or didn't just give an error when there was no $cm in 1.8 as it is done in 1.9. This would seem simplify the code as we could do:

if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) { error("Course Module missing"); }
// move require_course_login here to use forced language for course
// fix for MDL-6926
require_course_login($course, true, $cm);
$strforums = get_string("modulenameplural", "forum");
$strforum = get_string("modulename", "forum");
$buttontext = update_module_button($cm->id, $course->id, $strforum);

as we do in 1.9. Peace - Anthony


Dongsheng Cai added a comment - 06/Apr/09 02:18 PM
Thanks, Anthony, commited your patch to moodle 1.8

Dongsheng Cai added a comment - 08/Apr/09 02:37 PM
Fixed PHP warning, please review, thanks