Security and privacy

 
 
Picture of Richard Oelmann
Re: clean frontpage
Group Particularly helpful MoodlersGroup Testers

if you go to Settings > Site Administration > Security > Site Policies you can tick the setting to Force Users to Log in. You can then use your theme to style the login page with whatever images, text etc you want on it.

Richard

 
Average of ratings:Useful (1)
Picture of remco koffijberg
Re: clean frontpage
 

This works perfectly, thanks!

In addition (for later readers) you have to hide de guest login button, as explained here.

 

 

 
Average of ratings: -
Picture of Doug Moody
Re: clean frontpage
Group Particularly helpful Moodlers

I really don't want to create my own style, I just want to do what teh original poster asked. That is, just prevent the navigation block from shoing before login.

Why is this so difficult?

 
Average of ratings: -
Picture of Richard Oelmann
Re: clean frontpage
Group Particularly helpful MoodlersGroup Testers

OK - Its not so difficult. The option of styling the login page was exactly that - an option to make the log in page look exactly the way you want it, in other words you can force it to look like a front page, or like a standard webpage, or like anything else you want.

But here's another option if you want to hide the navigation block on the front page, although it does involve a little bit of coding.

Not knowing what theme you are using or what Moodle version, this example uses Arialist in 2.3 (I actually did it first in my own krystle theme on 2.4.1, but I wanted to give an example from a core theme)

 

In frontpage.php add the highlighted lines:

$bodyclasses = array();
if ($showsidepost) {
    $bodyclasses[] = 'side-post-only';
} else if (!$showsidepost) {
    $bodyclasses[] = 'content-only';
}
if ($hascustommenu) {
    $bodyclasses[] = 'has-custom-menu';
}
if (!isloggedin() {
    $bodyclasses[]='notloggedin';
}

 

At the end of core.css add

.notloggedin .block_navigation {display:none;}

 

Note - if this is the only block in the column, it may leave you with an empty column but giving the space for the column as Moodle will detect that there should be a block there, its just being hidden by the css. This is not an issue if other blocks are used in that column, but may need a bit more fiddling with to find a better solution if Navigation is the only one you have there.

HTH

Richard

 
Average of ratings: -
Picture of Doug Moody
Re: clean frontpage
Group Particularly helpful Moodlers

Richard,

I am going to make the assumption that when you said to make the above changes to frontpage.php and core.css, you meant to change those files that were in the directory for the style you are using in your moodle.

Am I correct? I ask because someone might inadvertently change the frontpage.php file in the admin/settings directory. I think that would be a mistake.

 
Average of ratings: -
Picture of Richard Oelmann
Re: clean frontpage
Group Particularly helpful MoodlersGroup Testers

Yes Doug, you are correct, the changes should be made in theme/arialist/layout/frontpage.php and theme/arialist/style/core.css - given that my example is based on using the arialist theme. I'm not sure why anyone would go looking in admin/settings when the post says I was giving an example using arialist theme and the response was about creating a style (or not having to!) but there we are.

Richard

 
Average of ratings: -
Picture of Doug Moody
Re: clean frontpage
Group Particularly helpful Moodlers

Richard,

I tried it in my own style (Binarius) and all it did was create a blank login page. Is there some secret I am missing?

 
Average of ratings: -
Picture of Richard Oelmann
Re: clean frontpage
Group Particularly helpful MoodlersGroup Testers

Doug, apologies there is an error in the code from me retyping it rather than copying and pasting - I was using 2 different computers at the time, one with my Moodle on and one with my emails smile

In the theme/arialist/frontpage.php code there is a bracket missing from the if statement 

if (!isloggedin()) {
    $bodyclasses[]='notloggedin';
}

I'm not sure why this would affect the login page though as that uses general.php according to the binarius config.php file - unless it was throwing up the error before getting to the login page itself. I assume as you say the page was blank, you do not have any error reporting enabled - the error in what I copied would then cause a blank page on any page using the frontpage.php layout, so i would assume that is what happened in your case Doug.

Apologies, and the simple bracket added should fix it smile I've just retested it in Binarius on Moodle2.4 and it worked fine.

Richard

PS. If you need any further help with this, it may be better to repost into the themes forum as the discussion now (if it ever really was) is not really about Security and Privacy.

R

 
Average of ratings: -