Moodle forum+mysql 5 = No news has been posted yet

Moodle forum+mysql 5 = No news has been posted yet

Höfundur Lars-Erik Edstom -
Number of replies: 20
I run lates stable moodle on my Debian Sid machine. After a system upgrade mysql 5 was installed instead of mysql 4 (due to security reasons I belive).

However, after that, forum doesn't work properly. When I add a new post i doesen't appear in forum discussions. The post can only be viewed from the course site were "latest news" can be seen.
Unfortunatly "older news" can't be viewed.

Is there a known incompabillity between mysql 5 and mod forum?
Anyone else who got the same problem?

/Lars-Erik
Meðaltal dóma: -
In reply to Lars-Erik Edstom

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Jonathan Woods -
Hi Lars-Erik,

I can confirm that this doesn't work on my MySQL5-based Moodle installation.  I did a new install of Moodle yesterday and my forums won't display new discussion topics.  They are in the system (e.g. in 'new forum posts') but are not displayed under the appropriate forum.

Please post any more info here and I will try to do the same.

Jonathan Woods
In reply to Jonathan Woods

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Max Stenlund -
I have the same problem...
In reply to Max Stenlund

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Helen Foster -
Mynd af Core developers Mynd af Documentation writers Mynd af Moodle HQ Mynd af Particularly helpful Moodlers Mynd af Plugin developers Mynd af Testers Mynd af Translators
Hi everyone,

Perhaps you could check bug 4618 and add to the report as necessary.
In reply to Jonathan Woods

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Lars-Erik Edstom -
It is possible to change some settings i mysql 5. I will try those changes as soon as I get som time off.

If I'm successful, I post back.

/Lars-Erik
In reply to Lars-Erik Edstom

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Max Stenlund -

Im not an expert in MySql (not even close...) but could it be this "bug" in MySql: http://bugs.mysql.com/bug.php?id=13551

There seem to be a workaround...

In reply to Max Stenlund

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Max Stenlund -

The Error message reads:

Unknown column 'd.usermodified' in 'on clause'

SELECT p.id,p.subject,p.modified,p.discussion,p.userid, d.name, d.timemodified, d.usermodified, d.groupid, u.firstname, u.lastname, u.email, u.picture , um.firstname AS umfirstname, um.lastname AS umlastname FROM mdl_forum_discussions d, mdl_forum_posts p, mdl_user u LEFT JOIN mdl_user um on (d.usermodified = um.id) WHERE d.forum = '10' AND p.discussion = d.id AND p.parent = 0 AND p.userid = u.id ORDER BY d.timemodified DESC

Is it possible that it should be (Based on the "bug" in MySql) :

SELECT p.id,p.subject,p.modified,p.discussion,p.userid, d.name, d.timemodified, d.usermodified, d.groupid, u.firstname, u.lastname, u.email, u.picture , um.firstname AS umfirstname, um.lastname AS umlastname FROM (mdl_forum_discussions d, mdl_forum_posts p, mdl_user u) LEFT JOIN mdl_user um on (d.usermodified = um.id) WHERE d.forum = '10' AND p.discussion = d.id AND p.parent = 0 AND p.userid = u.id ORDER BY d.timemodified DESC

I cant find the file (Im a newbee u know) so I can´´t test it myself...is it lib.php in mod/forum?

In reply to Max Stenlund

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Jonathan Woods -
Hi Max,

Adding those brackets seems to work.  Thanks for the research.  The file to modify is mod/forum/lib.php.  Search for 'forum_get_discussions' to get to the function.   The lines to modify are  about the 56th and  58th.  I've copied this section of the function below to show where I put the brackets.

    //TODO: there must be a nice way to do this that keeps both postgres and mysql 3.2x happy but I can't find it right now.
    if ($CFG->dbtype == 'postgres7') {
        return get_records_sql("SELECT $postdata, d.name, d.timemodified, d.usermodified, d.groupid,
                                   u.firstname, u.lastname, u.email, u.picture $umfields
                              FROM {$CFG->prefix}forum_discussions d
                              JOIN {$CFG->prefix}forum_posts p ON p.discussion = d.id
                              JOIN {$CFG->prefix}user u ON p.userid = u.id
                                   $umtable
                             WHERE d.forum = '$forum'
                               AND p.parent = 0
                                   $groupselect $userselect
                          ORDER BY $forumsort $limit");
    } else {
        return get_records_sql("SELECT $postdata, d.name, d.timemodified, d.usermodified, d.groupid,
                                   u.firstname, u.lastname, u.email, u.picture $umfields
bracket here ->       FROM ({$CFG->prefix}forum_discussions d,
                                   {$CFG->prefix}forum_posts p,
bracket here ->           {$CFG->prefix}user u) 
                                   $umtable
                             WHERE d.forum = '$forum'
                               AND p.discussion = d.id
                               AND p.parent = 0
                               AND p.userid = u.id $groupselect $userselect
                          ORDER BY $forumsort $limit");
    }

In reply to Jonathan Woods

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Max Stenlund -

Yes!

It works! My course is saved! Thank you!

Max

In reply to Jonathan Woods

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Lars-Erik Edstom -

Thanks! Forum discussions works perfectly.

In my Debian install, the rowes to be modified in /usr/share/moodle/mod/forum/lib.php, are rowes 1296-1298.


/Lars-Erik

In reply to Lars-Erik Edstom

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Bernardo Carvalho -

Hi there, I was having the same problem with the Forums, then I added the brackets and it works fine. Problem Im still having is when adding a new course, I get the message:

Serious Error! Could not create the new course!

I moved to a new server, and using MySQL 5

Any ideas please?

Many thanks

In reply to Bernardo Carvalho

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Iñaki Arenaza -
Mynd af Core developers Mynd af Documentation writers Mynd af Peer reviewers Mynd af Plugin developers
There have been several problemas with MySQL 5.x when the STRICT_TRANS_TABLES flag is on. You could check your my.cnf file and see if this is the case.

Saludos. Iñaki.
In reply to Jonathan Woods

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Herman A. Junge -
Just to say you THANX A LOT!!!

 You saved my site man. I'm just starting with AMP.

HAJ.-
In reply to Jonathan Woods

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Dan Stowell -
This fixed it for us as well - thanks for tracing the error.

I've posted it as bug 4875 so hopefully it can be fixed in 1.5.3 as well as in the development code. Please "vote" for that bug to be fixed if it has affected you!
In reply to Dan Stowell

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Martin Dougiamas -
Mynd af Core developers Mynd af Documentation writers Mynd af Moodle HQ Mynd af Particularly helpful Moodlers Mynd af Plugin developers Mynd af Testers
All fixed in CVS: STABLE and HEAD.
In reply to Martin Dougiamas

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Peter Ruthven-Stuart -
Mynd af Plugin developers
Martin,

Does this fix also apply to 1.6dev?

i.e. as far as you know, will MySQL 5 work with 1.6dev?

Thank you.
In reply to Jonathan Woods

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Armando Duran -
This worked great great great for me !
Thank you all !

-Armando
In reply to Jonathan Woods

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur M Y -

Thats the exact problem I have, does anybody have a solution to this.

In reply to Jonathan Woods

Re: Moodle forum+mysql 5 = No news has been posted yet

Höfundur Azizah Aziz -

i try to edit  the lib.php in /mod/forum  as you suggested, but it doesn't work. The news work fine before but today when i checked it says that no news has been posted. i'm using

MySQL client version: 4.1.22 and MySQL Server version: 5.0.91

Please help me. my site is http://www.lmsipda.net/lms/   

thank you.