Discussions not showing up

Discussions not showing up

by Mark Flach -
Number of replies: 31

I have a local (on my laptop) version of 1.5.2 runing and cannot get the forum activity working.  I can add a new Forum and then add a discussion but the discussions do not show up.  If I view the "Forums" page I can see my forum and the page indicates that there is a discussion.  If I select the forum, it says that "There are no discussion topics yet in this forum".

Any thoughts?

Average of ratings: Useful (1)
In reply to Mark Flach

Re: Discussions not showing up

by Charlie Ji -

Recently,I have the same problem.Moodle version is 1.5.3(stable).I haven't solve it yet.

Average of ratings: Useful (1)
In reply to Charlie Ji

Re: Discussions not showing up (Solved)

by Mark Flach -

I found the problem and the solution.  It looks like it might be a result of a change in MySQL 5.  It has to do with the order of the tables in the FROM clause in the SQL statement.  On line 1296 of mod/forum/lib.php you need to change the order of the FROM clause.  This is what it should look like:

FROM {$CFG->prefix}user u,
         {$CFG->prefix}forum_posts p,
         {$CFG->prefix}forum_discussions d 

Notice that I changed the order of the user table and the forum_discussion table.

Mark <><

Average of ratings: Useful (6)
In reply to Mark Flach

Re: Discussions not showing up (Solved)

by Charlie Ji -

Great!

I change mysql 5.0.15 to 4.1.17,then it works well.

Average of ratings: Useful (1)
In reply to Mark Flach

Re: Discussions not showing up (Solved)

by Carl Schmidt -
I also modified the /mod/forum/lib.php line 1296. Worked great.

Thanks!
Average of ratings: Useful (1)
In reply to Carl Schmidt

Re: Discussions not showing up (Solved)

by kevin chong -
i'm using mysql 5.0.15 too..
i followed the instruction by editing the line 1296 but still it wont works.

can u give more details on how the editing should be?
i'll paste mine and pls let me know if there is anything wrong with it. thanks!

/// Given a log entry, return the forum post details for it.

 global $CFG;

 

 if ($log->action == "add post") {

return get_record_sql("SELECT p.*, f.type AS forumtype, d.forum, d.groupid,

 u.firstname, u.lastname, u.email, u.picture

                               FROM {$CFG->prefix}user u,

          {$CFG->prefix}forum_posts p,

                                      {$CFG->prefix}forum_discussions d



                                
WHERE p.id = '$log->info'
 AND d.id = p.discussion
                               AND p.userid = u.id
 AND u.deleted <> '1'
 AND f.id = d.forum");

 


 


Average of ratings: Useful (1)
In reply to kevin chong

Re: Discussions not showing up (Solved)

by Brent Lee -
Hi Kevin,

Your code does not look to much like mine, please see my code attached:

Lines 1293-1305

else {
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}user u,
{$CFG->prefix}forum_posts p,
{$CFG->prefix}forum_discussions d
$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");
}

Email me at leeb@mala.bc.ca if you are still having problems, perhaps I can debug you quickly.

--B
Average of ratings: Useful (3)
In reply to Brent Lee

Re: Discussions not showing up (Solved)

by kevin chong -
Hi Brent,

Thanks for your reply. I edited the wrong lines previously and now that you provided me with correct lines to be edited, it works perfectly fine.

Once again, thanks and Happy New Year 2006!

cheers,
Kevin
Average of ratings: Useful (1)
In reply to Brent Lee

Re: Discussions not showing up (Solved)

by Andy Diament -

Hi and thanks for this advice which I needed quite desparately last night.

For the record, I found the fault around line 1330.

Would it be worth posting this (and the solution) to the bug tracker so that it makes it into cvs, or should it really be mySQL who should fix it.

Cheers

Andy D

Average of ratings: Useful (1)
In reply to Andy Diament

Re: Discussions not showing up (Solved)

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Would it be worth posting this (and the solution) to the bug tracker so that it makes it into cvs,

I would say so.

Saludos. Iñaki.  
Average of ratings: Useful (1)
In reply to Brent Lee

Re: Discussions not showing up (Solved)

by Vern Kollas -
OK, So after some updates to fix other problems, now I am getting this problem as well. I made the changes above, now all I get is a blank page when I open up any courses. Any thoughts??

Vern
Average of ratings: Useful (1)
In reply to Brent Lee

Re: Discussions not showing up (Solved)

by Adrian Porter -

I have tried this change but it doesn't work. Although it is only the 'standard forum for general use' that doesn't show up. A single simple discussion works OK.

Any othe ideas.

Adrian

In reply to Adrian Porter

Re: Discussions not showing up (Solved)

by Robert Sutherland -

It took me about four tries before I managed to make it work. Be careful that the comma's are in the correct place as well when you re-arrange those lines. The line moved to the top should have a comma, and the last one should not.

Ax

In reply to Robert Sutherland

Re: Discussions not showing up (Solved)

by Adrian Porter -

Excellent - it worked. Silly me for not seeing the comma out of place.

Many thanks

Adrian

In reply to Brent Lee

Re: Discussions not showing up (Solved)

by Nikos Mattheos -

hej all!

I feel a bit stupid to come back to a problem which most of you seem to have resolved some months ago, yet I just had my discussions dissapearing after an upgrade of the mySQL in the server. I tried to change the lines in lines 1293 - 1305 (and paid attention to the commas!) but I still don't see the discussions on the web sad

the code looks like that:

} else {
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}user u,
{$CFG->prefix}forum_posts p,
{$CFG->prefix}forum_discussions d
$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");
}

Any ideas?

many thanks!

Nikos

In reply to Nikos Mattheos

Re: Discussions not showing up (Solved)

by Paul Garrett -
My apologies, we re-checked code change and not it is working.  do you know if 1.6 includes this fix?
In reply to Brent Lee

Re: Discussions not showing up (Solved)

by Paul Garrett -

Kevin,

I am wondering if there has been a resolution to this issue on the latest stable branch for 1.5.3?  I am having his problem, and I made an initial pass at applying your changes without success.

In reply to Brent Lee

Re: Discussions not showing up (Solved)

by Johanna Bressler -
thank you very much, brent big grin


i just had the same problem after an update of the mySQL version with my provider. i was more than happy to find the perfect solution here in your post.


so weekend can come.....

best wishes from austria

from jo
In reply to Mark Flach

Re: Discussions not showing up (Solved)

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I made this modification after switching my Moodle installation to a new server on Win2003, IIS 6.0, PHP 5.1.2 and MySQL 5.0.18 and it worked perfectly (first time). Thanks for a great post. I hope that this was posted to the bug tracker. It is nice when a bug comes in with a solution attached. Peace.
In reply to Mark Flach

Re: Discussions not showing up (Solved)

by Christopher Cowley -

Thanks very much for your input here, this has solved my long standing problem of missing forums.

Regards Chris Cowley, Finland

In reply to Christopher Cowley

Re: Discussions not showing up (Solved)

by Doug Baleshta -
Chris, did you also roll back the db as well as make the changes to lib.php?  Or, were you able to stay with Mysql 5?

Thanks
Doug
In reply to Mark Flach

Re: Discussions not showing up (Solved)

by Charlie Roberts -

Thanks Mark, I've been using Moodle for a couple of years and this is the first time I really needed some help.  I appreciated your solution to this problem and it made me appreciate Open Source again.

Charlie

In reply to Mark Flach

Re: Discussions not showing up (Solved)

by Janet Hayes -
Hi Mark,

thanks for this fix.. it took me a little while to find the code (I'm using 1.7.2), however, once found and implemented, it works like a charm. I'm just slighly amazed that something so trivial can have such widespread impact.. best..janet
In reply to Mark Flach

Re: Discussions not showing up (Solved)

by Simon Fraser -
Mark You Da Man!!! I bow down before you!!!
You just saved me from slitting my wrists.

Two courses and 300 students are relying on the forums for most of the coursework grade.
In reply to Mark Flach

Re: Discussions not showing up (Solved)

by Doug Jones -

THANK YOU! 

Just another greatful Moodle user.  How did you ever figure that out?  You have racked up some good karma with this tip. 

Thanks again.

In reply to Mark Flach

Re: Discussions not showing up

by Larry Zoumas -
Thank you! That bug was making me sweat there for a while.

Will the code fix also work with MySQL 4.0 if we decide to downgrade?
In reply to Mark Flach

Re: Discussions not showing up

by james harding -

Thank you,

Changing the order of those lines fixed my problem!