Themes

Customizing front page in Moodle 2.x

 
Picture of Khaled Hassan
Customizing front page in Moodle 2.x
 

I am very new in moodle.Currently I am using Moodle 2.0 and I want to customize the front page. Now I can only set 4 items in front page before login.They are given bellow  

1.Combo list.                                                                                          

2. List of Courses.

3. News Items.

4. List of Categories.

But I want to customize it, want to add image and blocks(whatever I want in any position of the page) in front page . I think I have to change the content  in  core_renderer::MAIN_CONTENT_TOKEN in frontpage.php in theme/Layout folder. But it is difficult to understand for me how the MAIN_CONTENT_TOKEN changes eachtime when a new page is rendered.

Moreover in index.php there are 4 defined cases (FRONTPAGENEWS,FRONTPAGECOURSELIST,FRONTPAGECATEGORYNAMES,FRONTPAGECATEGORYCOMBO) . So I may have to change them too for moodle 2.x .So from where I should start to customize Moodle 2.x front page?

Best Regard 

Khaled

 
Average of ratings: -
Picture of Richard Oelmann
Re: Customizing front page in Moodle 2.x
Core developersParticularly helpful MoodlersPlugin developersTesters

If you enable the Topic section on the front page, that will give you an html block that you can use to add many things onto your front page (Settings>Front Page Settings>Edit Settings>Include a topic section)

There are also several themes now available which have the ability to put blocks in other locations besides just the sides. 2 I have put in the plugins database are Lagomorph and MultiLayout/MultiStyled - multilayout acts as a parent for multistyled but could be used separately with a different child to style it however you want. These have 2 regions above and 2 below the main content area as well as the sidebars. The aardvark_postit theme also has different block regions - in that case in the profilebar.

If you prefer a different theme, then looking at these will show you how you can add new block regions without having to create custom renderers for the main content, and certainly without hacking core code.

HTH

Richard

 
Average of ratings: -
Picture of Khaled Hassan
Re: Customizing front page in Moodle 2.x
 

Hi Richard,

Thanks for your reply and it was really helpful and informative. But there are two types of front page in moodle. One before login and other after login. Before login front page is very important because it is the gateway. According to your sugesstion I can add HTML block in after login front page. But How I can add a similar one in before login front page(Page that appears just before the login page) .

BR// Khaled.

 
Average of ratings: -
Mary Cooch
Re: Customizing front page in Moodle 2.x
Documentation writersMoodle Course Creator Certificate holdersMoodle HQParticularly helpful MoodlersTestersTranslators

If you follow Richard's advice copied and pasted below then you can add text before login as well

 

If you enable the Topic section on the front page, that will give you an html block that you can use to add many things onto your front page (Settings>Front Page Settings>Edit Settings>Include a topic section)

 
Average of ratings: -
Picture of Khaled Hassan
Re: Customizing front page in Moodle 2.x
 

Hi Cooch,

I have followed exactly Richard's instructions and can add any block, resource or activity in front page after login. But I can't add any block other than the fixed 4 options that were mentioned in front page setting for before login front page.  I think include topic section is only for front page after login not for before login front page. please correct me if I wrong.

I have attached the include topic section pic here.

BR// Khaled. 

 


 
Average of ratings: -
Picture of Khaled Hassan
Re: Customizing front page in Moodle 2.x
 

This is the front page after login. 

 

Bellow is the front page before login with no option for any modification and no topic section. Does it makes sense?

 
Average of ratings: -
It's only an avatar...
Re: Customizing front page in Moodle 2.x
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

Hi  Hassan,

Of course you will not see anything if you do not add  any content. There is a little icon, looks like a 'hand holding a pen' in the first image you uploaded (after login). Click the icon opens a TEXT EDITOR....ADD content and the content show up in the frontpage. OK

Here is my fontpage of my Moodle 2 website...

http://moodlestudio.co.uk

If you want to know more about how I did this email me and I will explain. My email is in the contact tab on  the site

Cheers

Mary

 
Average of ratings: Useful (1)
Picture of Khaled Hassan
Re: Customizing front page in Moodle 2.x
 

Hi Evans,

The first image was for after login not for before login as I mentioned earlier where the edit icon is available (hand holding a pen). However thanks for your comment and reply. Your customized front page is really good and I need such one for myself. I have sent you an email regarding this and will be glad if you kindly give me a reply.

Best Regard

Khaled.

 

 
Average of ratings: -
It's only an avatar...
Re: Customizing front page in Moodle 2.x
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

Hi

Of course the icon is in the section after you login. However the page WILL show on the outside of the site  when you log out providing you ADD some content for goodness sake!!!

Sorry if I seen angry...but really! Try adding something just to see what happens

Cheers

Mary

 
Average of ratings: -
Picture of Richard Oelmann
Re: Customizing front page in Moodle 2.x
Core developersParticularly helpful MoodlersPlugin developersTesters

Khaled,

I'm sorry it has taken me so long to reply - I have spent two days on the phone with BT about getting my internet connection working properly rather than working for 15minutes, then going off for a rest for a few hours! I must work it too hard LOL!!! smile

 

If you have any experience with ANY web pages, not just being new with Moodle, then it really is very straightforward:

As an Administrator, you get to see the edit tools - these are not visible when not logged in as the user then does not have the rights/permissions to edit anyway. Moodle operates on the basis of permissions - a site administrator can normally do anything anywhere on the site, through to a not-logged-in user, who can usually only view certain pages that have been opened to the public, and definitely cannot (under standard permissions) add/edit blocks or any other content.

If there is content in a block (e.g. the Topic section of the front page) Moodle will display that block, regardless of whether the user is logged in or not. If the block has no content there is nothing for Moodle to display!

Log on as Administrator and Turn Editing On (either a button near the top of the screen, or in the Settings block in the sidebar). You should then see the hand holding a pencil icon.

Click on this icon and you will see a text editor to add content. You can style this content in the same way as using a fairly basic word processor, without the need to add the html itself - or more complex features can be added by clicking the HTML button to view and edit the code directly.

This in turn means that the content in this Topic section on the front page (and any other similar sections on course pages) can contain just about anything you want to see on a normal webpage - whether you want it to look similar to Mary's example (where the Topic section matches beautifully with the rest of the theme on the page) or, as has been requested in other discussions on this forum, something that looks like the front page of moodle.org itself with the large icons. They are all created simply using html in that topic box I pointed out to you in the original reply.

But it will not display if there is no content!!!

 
Average of ratings: -
Picture of Khaled Hassan
Re: Customizing front page in Moodle 2.x
 

Hi guys,

Thanks for your support. I got it.

Mary, I am sorry for bothering you with a so trivial issue. However thanks for your help. 

BR// Khaled. 

 
Average of ratings: -
Picture of Khaled Hassan
Re: Customizing front page in Moodle 2.x
 

Hi,

I have customized the front page properly. Now after login I have found the similiar frontpage as HOME page. If I want to directly go My Home page instead of going HOME page after login, what I have to do?

BR// Khaled. 

 
Average of ratings: -
It's only an avatar...
Re: Customizing front page in Moodle 2.x
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

Hi Khaled

This used to happen automatically but they changed the format in newer versions of Moodle. I remember reading about this but can't remember where I read this. Try reading thru Development: Themes 2.0

EDIT: I just Googled My Hompage and found this:

An administrator can set My home as the default home page for all logged-in users by selecting 'My Moodle' as default home page in Settings > Site administration > Appearance > Navigation.

smile

Mary

 
Average of ratings: -
Picture of Khaled Hassan
Re: Customizing front page in Moodle 2.x
 

Hi Mary,

Thanks for your reply. I have changed it (My Moodle)  from  

Settings > Site administration > Appearance > Navigation

Now users HOME page is My home, that is Ok. But after login I still get Site home page first before getting My home page while it is logical to applear My home page first just after login. Any solution?

 

BR// Khaled. 

 

 

 
Average of ratings: -
Picture of Khaled Hassan
Re: Customizing front page in Moodle 2.x
 

I think only Administrator get the site home page as a Home page and There was a discusstion about this topic in forum. 

BR // Khaled. 

 
Average of ratings: -
Picture of Richard Oelmann
Re: Customizing front page in Moodle 2.x
Core developersParticularly helpful MoodlersPlugin developersTesters

That is the expected behaviour, as I understand things, Khaled. When My Home is selected as the default home page for logged in users, Administrator still has the site home page as Home.

 
Average of ratings: -
It's only an avatar...
Re: Customizing front page in Moodle 2.x
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

I've just deleted a message here which I was not theme related and as other post by the same person is elsewhere on the forums I suspect was SPAM

 
Average of ratings: -
Me
Re: Customizing front page in Moodle 2.x
 

It appears that there is a bug that prevents administrators from seeing the SITE HOME PAGE when MY Moodle is being used.

 

http://tracker.moodle.org/browse/MDL-30355?focusedCommentId=132396#comment-132396

 
Average of ratings: -
Picture of Andy Wright
Re: Customizing front page in Moodle 2.x
 

Hi, not sure if this has already been answered as I only skim-read the above but is there a way of having an image (or custom html block generally) appear on the before log in homepage and then disappear once the user logs in and be replaced by the course category list? I know you can put an image and pretty much whatever else into the WYSIWYG editor in front page settings, but I can't seem to change the settings for this specific content, so that it only appears before user login.

Any ideas?

Andy

 
Average of ratings: -
It's only an avatar...
Re: Customizing front page in Moodle 2.x
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

Hi,

If you just wanted a section of text and an image, or whatever, to display before a user logins in, you can do this is the Site Topic section just as long as you set the course information to appear after login.

To make the Site Topc visible, you need to click on  Edit Frontpage settings. Then tick the box that enables Site topic and then select the things you want to show on the frontpage before and after login. If you make all the first set NONE and have courses or COMBO selected for after login. This will make the frontpage empty before login until you add something in the site topic area. Which you can do after you Turn editing on in the frontpage.

Mary

 
Average of ratings: -
Mary Cooch
Re: Customizing front page in Moodle 2.x
Documentation writersMoodle Course Creator Certificate holdersMoodle HQParticularly helpful MoodlersTestersTranslators

Andy - you want to add a custom HTML block visible BEFORE login and  for it to be replaced by  the courses block AFTER login? 

On the HTML block you need to change its permissions so it is not viewable by authenticated users. On the courses block you need to change its permissions so it is not viewable by guests. FAQ #1 here  is an  example of changing permissions on blocks - use this to tweak the blocks for your purposes: http://docs.moodle.org/23/en/Blocks_FAQ

 
Average of ratings: -
Picture of Brayton Maine
Re: Customizing front page in Moodle 2.x
 

Mary Evans and Mary Cooch,


I don't understand the explanation of this solution. I have done multiple searches in the forums and have found a variety of ways to get around this problem.

Personally what I would like is for the "pre-login" page to show a general greeting. The only thing the front "pre-login" page should show is a general greeting in the center of the page and then a login block on the right hand side of the screen.


What I would like the "post-login" page to show is the courses a user is enroled into and any blocks necessary for navigation on the right hand side of the screen. I would like the "pre-login" welcome message to disappear.


From what I have come to understand about my situation (although I may be mistaken) is that it is possible to add a "Site Topic" to input information. However, this "Site Topic" area's permissions can't be changed. Is this correct?

From what I have researched, this is why an "HTML Block" is perferred for these types of sections. With a block you can change the permission to remove it from the view of a guest. I am familiar with this style of hiding content because my current moodle's front page only shows the login block.

Is there something I am not understanding about how to hide this content?

From my understanding of Mary Evans's post, I have set the content before login to all "None." I have content in my "Site Topic" area. Sure enough, "pre-login" it shows my site topic but after login it shows my list of courses in addition to the "Site Topic" message.

From my undestanding of Mary Cooch's post, what I need to enable is an "HTML Block." I'm familiar with creating blocks, but my theme only allows blocks on the side of the screen. Should I look into adding a block into the center of the screen or investigate switching to a new theme?


Any assistance in figuring out this problem is greatly appreciated.

Brayton

 
Average of ratings: -
Mary Cooch
Re: Customizing front page in Moodle 2.x
Documentation writersMoodle Course Creator Certificate holdersMoodle HQParticularly helpful MoodlersTestersTranslators

Hi again. First of all, much of what you are saying is correct so you do understand it smile

I suggested using side html blocks precisely  because afaik you can't edit the topic summary permissions so that only logged in users can see the message, so the topic summary appears whether you are logged in or not regardless of the front page settings. I think there is a (non-codey) solution but it's not pretty:

Add a label to your central topic section and put in the content you wish users to see once logged in. Then hide the label with the "eye". It won't be seen by guests. Then go to Settings>Site admin>users>permissions>define roles and edit the authenticated user role to allow them to view hidden activities


 
Average of ratings: -
Picture of Brayton Maine
Re: Customizing front page in Moodle 2.x
 

Thank you Mary for your "non coding" answer to my problem. There is still a lot I need to learn about php and css to really take control of the moodle page I'm in charge of. I think I will use your solution until I can find a more permanent method, such as the one Mary Evans provided below.


Again, thank you very much.

-Brayton

 
Average of ratings: -
It's only an avatar...
Re: Customizing front page in Moodle 2.x
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

 

OK,

Here is an alternative.

  1. GOTO settings > site administration > security > site policy
    and enable FORCE LOGIN
  2. OPEN your theme's config.php and change the file name for LOGIN under $THEME->layouts from this:
        'login' => array(
            'file' => 'general.php',
            'regions' => array(),
            'options' => array('langmenu'=>true),
        ),
    to this:
        'login' => array(
            'file' => 'login.php',
            'regions' => array(),
            'options' => array('langmenu'=>true),
        ),
  3. ADD the attached login.php file to your theme's layout directory

If you follow those steps you will get a login page that ONLY contains the Login details, either a single column or a double column depending on what login settings you have under plugins authentication self enrolment.

To customise the Login page you can add some XHTML to the file itself and style it using CSS, which you will need to add to the existing CSS stylesheet for the theme.

Cheers

Mary

 
Average of ratings: -
Picture of Brayton Maine
Re: Customizing front page in Moodle 2.x
 

This is a perfect solution. However, if my understanding is correct, instead of using the attached login.php, I could in fact make a copy of "general.php" and apply changes directly to this code. Then I could rename it to become my "login.php" and change the file used in "config.php". Correct? The reason I ask, all morning I was looking at the differences between "general.php" and your "login.php" and trying to learn from them. I selected a majority of the code in "general.php" to format the page to match the rest of the website. However, I just couldn't quite format "login.php" to my wishes. Do you foresee any possible problems with using a renamed copy of "general.php" and used as a login page?


Again, thank you so much.


PS. A common error I encounter relates to "<?php echo $OUTPUT->main_content() ?>" Can you please explain why this is required on the login page? The reason I ask is that I'm guessing this is what is calling up the "Login Box" on the blank page. Instead of using this OUTPUT of main_content what I'd like to use is the login block located in the side post region. If I don't want to use this code, how can I adjust it so the page isn't required to use it?

 
Average of ratings: -
Picture of Brayton Maine
Re: Customizing front page in Moodle 2.x
 

After researching this call function, I realize how important it is. But I wonder, is there a way to customize how the function outputs content? I think I'm hot on the trails to an optimal solution.

Thanks again for the invaluable help on this forum.

Brayton Maine

 
Average of ratings: -
It's only an avatar...
Re: Customizing front page in Moodle 2.x
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

Have you read any of the tutorials listed at the top of this Forum page?

The one you need to look at is Themes 2.0 at the bottom of which is a long list of more tutorials one of which is using renderers to customise you theme.

 
Average of ratings: -
Picture of Brayton Maine
Re: Customizing front page in Moodle 2.x
 

I have looked at the Themes 2.0 documentation and more specifically the overriding renderers tutorial before. It was a little too overwhelming and I stopped (with a different problem I was having with quizzes). I was hoping there would be an easy answer. I now realize I'm going to have to set aside some time to really study up on this to fully customize moodle beyond what I'm currently capable of.

Thanks again for pointing me in the right direction.

Brayton

 
Average of ratings: -
Picture of Mike Senders
Ynt: Re: Customizing front page in Moodle 2.x
 

Hi Mary,

Is there any proper way or a listed document which shows step by step instructions on how to modify or change the front page of Moodle 2.x?

Thank you so much in advance.

-Mike

 
Average of ratings: -
It's only an avatar...
Re: Ynt: Re: Customizing front page in Moodle 2.x
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

Hi Mike, 

There is a link to all the tutorials for Moodle 2.0+ at the top of this forum.

I would say that these are the best of the bunch...

http://docs.moodle.org/dev/Themes

as they relate to the more up to date versions of Moodle.

But as for changing the Frontpage...you may find this useful...

http://docs.moodle.org/23/en/Front_page_FAQ

If there is anything specific you want to know then, just start a new topic and ask for help. I'll certainly help you work through some ideas you may have about a specific look of your Moodle site which you are trying to achive.

Hope this helps?

Mary

 
Average of ratings: -
Picture of steve brydges
Re: Customizing front page in Moodle 2.x
 

I know this is not Khaled's issue, but I was reading this discussion 'thinking' I had a similar issue about not being able to customise the front page for a non-logged-in user.

Actually I had set the Site Policy to 'Force users to Login' so what I thought was a very sparse front page was actually the login page.

 
Average of ratings: -
Picture of Robert Morriss
Re: Customizing front page in Moodle 2.x
 

thanks Steve, it's 4 years after your post, and your comment is still pertinent.  The Site Policy parameter is affecting what is displayed on my non-logged-in front page.


As for the customization issues discussed in this thread, I think this link provides a description of the steps to make the summary information appear on the non-logged-in front page.

 http://www.inmotionhosting.com/support/edu/moodle/changing-appearance-moodle/customize-front-page

I think the terminology used has caused much of the confusion.  The word "summary" is used to describe two different pieces of information. 

1) Under Front Page Settings there is a text box entitled Front Page Summary.   This is not the summary, however, that is going to automatically appear on the front page.  This summary is associated with the Course Site summary block.  You must use the Add a block feature to place this information on any of your pages.

2)  Also under Front Page Settings there is the check box for "Include a topic section".  When checked a topic module (topic as in a topic within a course) will be placed on the front page.  This is entry point for the information that will be displayed on the non-logged-in page.  When editing this topic module, the term summary is used as a tooltip for the editing icon.  And the term summary is used again when editing the topic module. 

Yikes!   That is the best that I can do. 
 
Average of ratings: -