|
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 Assigning to Dongsheng... can you take a look to this?
This patch is against moodle 1.8.
Also fix the other strings in post page and forum frontpage. 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 For 18STABLE we now have a PHP notice with the code as it is. Please re-check the logic.
Here is the revised logic that I think accomplishes what we are aiming for. Peace - Anthony
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
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");
} as we do in 1.9. Peace - Anthony Thanks, Anthony, commited your patch to moodle 1.8
Fixed PHP warning, please review, thanks
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I think the problem is that the string definition is loaded before the course, should be fixed now, thanks.