Collapsing the Site news articles for visitors

Collapsing the Site news articles for visitors

by Dan Segarra -
Number of replies: 31

Greetings, a stange thing happened. Previously News articles were shown in a collapsed view on the front page with the option of "Reading the rest of the topic" this allowed for multiple articles and a clean look. Now for some reason the articles are fully expanded and only collapsed when I log in as the admin. So what my guest see is a LONG web page. How do I get this back to the collapsed version for guests and students with the option of reading more?

Take a look:

www.warrior-scholar.com/moodle/

Thanks

Happy New Year!

Average of ratings: -
In reply to Dan Segarra

Re: Collapsing the Site news articles for visitors

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Dan,

Please try reducing the forum_shortpost and/or forum_longpost variables in Administration >> Configuration >> Modules >> Forum.
In reply to Helen Foster

Re: Collapsing the Site news articles for visitors

by Dan Segarra -
I tried that, but it still behaves the same way. Odd. When I log in as admin it condenses with a read more option but as a normal user or visitor it shows the whole thing. I recently played with the header to add a logo on top and added hotpotato's but they shouldnt have created this problem, ortherwise I would have imaginged it would happen during admin logins as well.
In reply to Dan Segarra

Re: Collapsing the Site news articles for visitors

by Dan Segarra -

I was thinking does moodle generate a different page for the admin than the regular user? If so maybe someone could help me spot the code setting that is causing the short version (the one I want) on the admin page verse the long version (the one I dont want) on the student main page by comparing the two.

I tried the settings in the config/forum area, didnt work.

I would realy like to fix this it makes the front page look sloppy, because the news items are squashed and appear even longer.

Thanks.

Happy New Year!

In reply to Dan Segarra

Re: Collapsing the Site news articles for visitors

by Steve Hyndman -

Dan,

Just a shot in the dark here, but I see you have done some customization of your theme. I'm wondering if the problem is somewhere in the theme css. Have you changed your site to a different (standard) theme to see if the problem still exists? 

Steve

In reply to Steve Hyndman

Re: Collapsing the Site news articles for visitors

by Dan Segarra -

Thanks Steve, If I change themes will I loose anything?

Thanks

Dan

In reply to Dan Segarra

Re: Collapsing the Site news articles for visitors

by Steve Hyndman -

No...themes just determine the general look and layout of your site. Changing back to your original theme will change everything back the way it was.

In reply to Steve Hyndman

Re: Collapsing the Site news articles for visitors

by Dan Segarra -
No it didn't work sad Same problem. All I monkied around with lately was the header and the footer. That's it.
In reply to Dan Segarra

Re: Collapsing the Site news articles for visitors

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Dan,

If you've added a header logo by modifying any files outside your theme folder then this may be the cause of the problem. Perhaps you could try replacing your modified files with the original files.
In reply to Dan Segarra

Re: Collapsing the Site news articles for visitors

by Steve Hyndman -

Hummm....

I keep going back to Helen's original suggestion about the shortpost and longpost values in the forum module. I've played around with this on my site and although I can't replicate your problem where it is different for the admin, it does impact the length though.

Just for the heck of it, you may want to change those values...the default is 300 and 600. I changed mine to 150 and 200. You may want to give this a try and make sure your cache is cleared (ctrl+f5 a few times)....cahced pages have caused me problems on more than one occasion.

Steve 

In reply to Steve Hyndman

Re: Collapsing the Site news articles for visitors

by Dan Segarra -

I've tried that (long post/short post) and it only effects the Admins page not the guest. And I also tried your suggestion of clearing the cache same results.

Helen, the only thing I modified was the header in the theme. I'm not skilled enough to monkey around beyond that. I also reloaded the original header file No improvement. Also if I changed themes like Steve recommended then a different header was in play so it cant be the header.

Maybe I broke it.

Keep the help coming I appreciate it.

Thanks

Dan

In reply to Dan Segarra

Re: Collapsing the Site news articles for visitors

by Steve Hyndman -

Dan,

I just noticed you are using Moodle 1.4.3. Is there a reason you don't want to upgrade to 1.5.3? I know you may have to redo your theme a bit, but it will be worth it in the long run. 1.5.3 does have the problem I reported here, but I have the discuss.php file from 1.5.2 you can load to overcome that until it's fixed. I'm out of ideas, but an upgrade may fix your problem.

Steve

In reply to Steve Hyndman

Re: Collapsing the Site news articles for visitors

by Dan Segarra -

How hard is it to upgrade? and where would I find the instructions? I didnt even know what verision I had until you mentioned it. Would I loose my courses, members etc?

Thanks for the help.

Dan

In reply to Dan Segarra

Re: Collapsing the Site news articles for visitors

by Steve Hyndman -

Dan,

I just looked at the source code of your site homepage in my browser...it indicates your version is 1.4. You can check this by loggin in and looking in the admin area of your site....bottom of the page where you are prompted to register your site.

You can get the latest version from the download area on moodle.org here:

http://download.moodle.org/

Be sure to back-up your database and moodledata directory. When I upgrade, I use cpanel file manager and just rename my original moodle directory to something else like (moodleBAK). Then I upload the new moodle zip to the same level directory where my original exist....in your case it would be www.warrior-scholar.com and unzip the file.

This will result in the new files now being in a "moodle" directory. Then copy across your config.php and any custom themes, blocks, etc. from moodleBAK to your new moodle directory. If your moodledata directory is in your moodle directory (shouldn't be, but may be if you did an automatic install through fantastico) then you will need to copy this across as well. It is a good idea to go ahead and move moodledata outside your public_html directory if it's not already there...if you do this, just open the config.php and change the location of your datadirectory.

Also, there was a big change in the way themes are programmed between 1.4 and 1.5, so I would recommend before you start any of this, go into your admin area of your 1.4 site and change your site theme to one of the standard Moodle Themes. This should make the upgrade go smooth. Once you upgrade, then you can select your custom theme in 1.5 and see if you will need to make any changes. This probably isn't an absolutely necessary step, but it will just lessen the potential problems you may run into during the upgrade.

Visit your site in the browser and type /admin in the browser address...in your cases it would be www.warrior-scholar/moodle/admin, and you will be stepped through the process of updating your database.

I've never lost anything during an upgrade...Moodle is famous for its smooth, painless upgrades; however, it's still a good idea to back-up everything (database and moodledata directory) first. Also, I keep my moodleBAK directory until the next upgrade. That way I have all the original files in case I forgotten a hack, a theme, or whatever...the original files are still there and handy. In a worse case scenario, I could also fall back to my original site with the backup database and original codebase.

I know this may sound difficult, but it's really pretty easy once you give it a try. All the directions are in the download area of moodle.org as well.

Steve

In reply to Steve Hyndman

Re: Collapsing the Site news articles for visitors

by Dan Segarra -

O.K that was an absoulute debacle and misrable experience! Six hours later I got the site back up and running after deleting my entire database by accident (dont ask) This stupid problem is like a small thread one tugged the whole thing unraveled.

So How do I delete Moodle from my database? Is moddle prefixed by mdl in the database? Id so I'll delete all of those files reinstall 1.4 and quit while I'm ahead.

The upgrade was ridiculously confusing and corrupted all kinds of stuff in the database. I'll be happy with 1.4 if I can get it up and running again. I have all the graphics saved so wiping it out is not too much of a hassle I'll resubmit the members myself.

So can I get rid of all traces in the database by deleting everything with a mdl in front of it?

In reply to Dan Segarra

Re: Collapsing the Site news articles for visitors

by Steve Hyndman -

Dan,

Yes, all tables in Moodle are prefixed with mdl_ except for the adodb_logsql table.

Unless you are using your database for other applications, then that should be all that is in the database. As long as you backed-up your database you should be able to restore it back the way it was with no problem.

See the private message here for more information.

I'm doing a Moodle workshop for a school today until about 3:30, but will be back online later this evening.

Steve

In reply to Dan Segarra

Re: Collapsing the Site news articles for visitors

by Steve Hyndman -

Hello Moodlers,

I helped Dan fix this problem on this site last week by upgrading to the latest version of Moodle. Tried a lot of "stuff" and finally narrowed down the problem to something in the database...although I couldn't find what it was.

Well...would you believe it, now I'm having the same problem on a new site I'm helping a friend set-up. My Moodle 1.5.3 site is doing the same thing Dan's 1.4 site was doing....news articles collapsed when logged in as admin, but not collapsed when not logged in or when logged in as a user.

This isn't a huge problem for us since we will only be showing about three news items at a time, but it would be nice to get it working like it should.

Is anyone else experiencing this problem? or does anyone have ideas as to what may be causing it?

Based on my experience with Dan's site, if I were to install a fresh (no upgrade) Moodle, I wouldn't have the problem. If I were to upgrade, the problem would still exist. I even exported the database from the old site, installed a fresh site and imported the database...the problem still existed. It seems like something happens...the site gets "stuck" in this mode, and then there is no fixing it short of a new database thoughtful Very strange. Any suggestions welcomed.

Oh...the site is here: http://kyca.org/moodle/

Steve

In reply to Steve Hyndman

Re: Collapsing the Site news articles for visitors

by Steve Hyndman -

Okay...I've narrowed this problem to the forum tables in the database. I've attached an sql file with the forum tables that displays the site news uncollapsed for unless you log in as admin. I'll reply to this post and attach another sql file with forum tables that work properly...I can't find the setting that is causing this.

Steve

In reply to Steve Hyndman

Re: Collapsing the Site news articles for visitors

by Worth Bishop -
Here are a few observations that may help:

Forum Setting                                             Behavior                             

Discussions and replies are allowed               Collapsed for world & student

No discussions but replies are allowed           Collapsed for world & student

No discussions, no replies                             Collapsed for  Admins only

I think the code is in /moodle/mod/forum/lib.php. Will try to see if I can tweak it to change the behavior so it's the same for all.

Anyone else already have a fix, I'd appreciate knowing about it.

Thanks,

WB
In reply to Worth Bishop

Re: Collapsing the Site news articles for visitors

by Steve Hyndman -

Thanks for the feedback WB. I've moved the news to show in the latest news block on a couple of my sites because of this. Would be interested to hear if anyone finds a fix.

Steve

In reply to Steve Hyndman

Re: Collapsing the Site news articles for visitors

by Worth Bishop -
I'm continuing to wrestle with this as well.

There's another piece of this puzzle - when using a forum setting that enables the discussions to be collapsed ("Replies allowed" or "Discussions and Replies"), a visitor must register and log in to see the expanded post. Logging in as a guest doesn't allow visitors to see the full discussion.

We would like to be able to set the front page forum with "No discussions, no replies," with the discussions collapsed and allow anyone access to the full discussion in this forum.

If we come up with anything, I'll post it here.

In reply to Worth Bishop

Re: Collapsing the Site news articles for visitors

by mandy honeyman -

Helen pointed me to this thread from our discussion somewhere else. I've been experiencing the same problem.

If anyone has come up with a resolution please do let me know.

I have added a bug report bug 4781.

cheers
Mandy

In reply to mandy honeyman

Re: Collapsing the Site news articles for visitors

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
I think I have a solution to this. Please, test it and tell me if it works in your environment. If it does, we can then propose this as a solution for the bug.

Edit ...moodle/mod/forum/lib.php, and go to line 2807 (this is for 1.5.3+, yours may vary). You'll see something like this:
if ($canreply or $discussion->replies) {
Change it to:
if ($canreply or $discussion->replies or (strlen(strip_tags($discussion->message)) > $CFG->forum_longpost)) {
And test it. Please, report any success/failure here smile

Saludos. Iñaki.


In reply to Iñaki Arenaza

Re: Collapsing the Site news articles for visitors

by mandy honeyman -
Hello,

Sorry that had no effect whatsoever!

However, you gave me the courage to have a bash and I took out the $link reference from line 1643 so now it reads:

    if (strlen(strip_tags($post->message)) > $CFG->forum_longpost) {

and that does work (for me thoughtful) - I now get the readtherest link, but not the debate or discuss links.

though I am very concerned that I might have broken something else in the process!

cheers
Mandy
In reply to mandy honeyman

Re: Collapsing the Site news articles for visitors

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
Humm, it works in my test environment (Moodle 1.5.3+, Site News forum with "No discussions, no Replies"). What version of Moodle are you using? What settings do you have for the forum you are testing?

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Collapsing the Site news articles for visitors

by mandy honeyman -
Sorry, while you were typing I was editing, see above wink.
this was 1.5.3 and the news forum for front page (no discussion no replies).
cheers
In reply to mandy honeyman

Re: Collapsing the Site news articles for visitors

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
This has the bad side effect (at least in my test server) that when you click on the 'Read the rest of the comment...." link, you only get the introductory part again. Do you get the full text?

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Collapsing the Site news articles for visitors

by mandy honeyman -
So sorry Iñaki
I went back and tried your solution again (after my debacle!) and I do get the readtherest link but I also get a "discuss this topic" link for unlogged in users which is incorrect (as this is set to no replies/no discussion). That is, most surely, the lesser of two evils wink so I shall leave it like this for now.

BTW In my lib.php the change was on line 2760 even though I am on 1.5.3 as you are.
cheers
Mandy


In reply to mandy honeyman

Re: Collapsing the Site news articles for visitors

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
and I do get the readtherest link but I also get a "discuss this topic" link for unlogged in users which is incorrect

The same flag controls whether we are shown collapsed posts and are allowed to discuss the topic or not.

Without doing quite a bit of surgery to the forum code, this is the best you can get sad

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Collapsing the Site news articles for visitors

by mandy honeyman -
Then that would appear to be the best we can get!

I'm not really sure how the bug tracker works, will you put in your solution?

How does that then get transferred to the cvs/and or the code for the next version?

And finally is it not still really a bug if it isn't working in absolutely the correct way?

cheers
Mandy