Moodle Tip: Show a different front page to guests and logged in users

Moodle Tip: Show a different front page to guests and logged in users

by Mary Cooch -
Number of replies: 7
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

OK this isn't strictly speaking a teaching tip, although you can apply it as a teacher in your course if you want a message for guests only, but it is a non-technical tip, involving no coding or hacking files on the server - the kind I like best.

There are various complex ways and theming ways to get your front page looking different for guests and logged in users. You can  also use block permissions to allow only logged in users to view blocks - see Blocks FAQ -  but you can't do this with a label as there is no "view label" permission. You can use Conditional activities however, if they are enabled on your site.

Here is my 21st Century Cats site (which I made earlier!) I restricted all the blocks so they are only visible to logged in users and I added a welcome label to guests:


Then, I set the label's access restrictions so:


So basically - if you don't have an email address then you can see this label. If you are not logged in,  then Moodle does't know whether you have an email or not,  so you can see it.

Here is the logged in view. Bobby Black can now see his regular Administration and Navigation block - but the message (label) has changed:


 (By the way; I am not promoting this as good front page design - it's just the tip, not the appearance big grin  ) He can't see the previous one because as a logged in user, he has an email address - so it has gone.

In this second label, the  message to logged in  users, I set the access restrictions so:


It was a forum thread from the French Community that led to this idea, so Merci to Patrick Lemaire and the others over there. 


Average of ratings: Useful (8)
In reply to Mary Cooch

Re: Moodle Tip: Show a different front page to guests and logged in users

by Itamar Tzadok -

How about showing a different home page of this kind to each logged in user (personalization)? smile

Average of ratings: Useful (1)
In reply to Itamar Tzadok

Re: Moodle Tip: Show a different front page to guests and logged in users

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

It never endsbig grin

Average of ratings: Useful (2)
In reply to Mary Cooch

Re: Moodle Tip: Show a different front page to guests and logged in users

by Itamar Tzadok -

Well, some its can be ended to some extent. smile Here is a "personalized" variation on the "different front page to guests and logged in" tip.

1. Guest view (have borrowed the image from your illustration).


2. User view before personalization.


3. User adding personalized content.


4. User view after personalization.


5. Another user's personalized view.



The how-to will be posted in the Dataform module docs.

smile



Average of ratings: Useful (2)
In reply to Mary Cooch

Re: Moodle Tip: Show a different front page to guests and logged in users

by Debbie McDonald -

Mary is there a way to assign teachers to different labels on the front page so they only have access to edit the label they are assigned to?

In reply to Debbie McDonald

Re: Moodle Tip: Show a different front page to guests and logged in users

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

I can't think of an easy or obvious way to do this, sorry. Perhaps if you can say a bit more about what you want to achieve, we could offer some alternative suggestions?

In reply to Debbie McDonald

Re: Moodle Tip: Show a different front page to guests and logged in users

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers

Hi Debbie,

As Mary said, no easy way to achieve this, but I played around in my sandbox (a fresh install of 2.9) and I was able to achieve what you are looking for. It’s a lot of steps, so it’s not simple, but this worked for me.


Two Things to keep in mind:

• This is dependent on how your role permissions are already set up, so the follow steps should account for that. Try this out in your sandbox first.

• For teachers to be able to see the “Turn Editing On” on the front page (even if you lock down everything to where they can only edit a specific label), they will also have access to the “Edit Settings” cog under “Front Page Setting” – at the course level, you can lock down certain fields on that page (such as

moodle/course:changeshortname, moodle/course:changefullname, and  moodle/course:changecoursesummary, but this does not work for the Front Page sadly. So can you trust your staff not to make any changes to the Front Page setting? That’s a question for you/your admin team. *


Otherwise, give this a try: 

  1. Navigate to Site Admin – Users – Permissions – Define Roles: Make sure these permissions are set to N/A for the ‘Authenticated User on Front Page’ role and for the ‘Authenticated User’ role.
    • moodle/course:manageactivities
    • moodle/course:update

  2. Navigate to Front Page Settings (NOT under Site Admin) – Users – Permissions: verify these same two roles above are not listed under this “Roles with Permissions” column or the “Prohibited” column for the above two listed permissions.

  3. Navigate to Site Admin – Users – Permissions – Define Roles: Duplicate the Front Page role for each label you want a group to edit (i.e. if you want a Math Dept label and a Science Dept lable, then duplicate that role twice)
    • Click Define New Role
    • Select “Archetype: Authenticated user on front page” from the drop down & click Continue.
    •Give it a Short and Full name:
      (ie. Front Page Science Label / userfpsci)
      (Front Page Math Label / userfpmath)
    • Check of ‘System’ and ‘Activity Module’ under ‘Context where this role may be assigned’ – this way, you can add users to this role system wide and then assign this role to the label activity permissions on the front page
    • Click the ‘Create this Role’ button
    • DO NOT make any permission changes here.

  4. Navigate to Site Admin – Users – Permissions – Assign System Roles: add the Science teachers to the Science front page role, and the Math teachers to the math front page role, etc…

  5. Go to the Front Page and add one label per department. Throw a title in the labels (ie. Science Label / Math Label).

  6. Click on the ‘Edit’ dropdown for the Science Label and select “Assign Roles” : you should now see Front Page Science Label as a listed role (it may say 0 users with this role for your 2 new roles, but if you click on the role, you’ll see your users are already assigned to it at the system level versus the activity level. You could always set it up so they are assigned at the activity level only, but your 2 new system roles don’t have any additional permissions so you are okay – the next step will take care of this).

  7. While in the same screen as step 6, click on “Permissions” in the Label admin block. If this is your Science label, add the Front Page Sci Label group to the following permission (then repeat this step for each label):
    • moodle/course:manageactivities

  8. Navigate to Front Page Settings (NOT under Site Admin) – Users – Permissions:
    • Add all your new front page roles to this permission
    • moodle/course:update
    • Now, with this, your users will see the “Turn Editing On” option. (Remember, they will now also see the “Edit Front page Setting” cog too).

  9. Now, log in as one user from each group and verify they can now edit the front page but for ONLY the label they were assigned to, no other label and no other activity on the front page.

Hope this works for you as well with your existing set up.

In reply to Debbie McDonald

Re: Moodle Tip: Show a different front page to guests and logged in users

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers
Debbie -- I found an easier methods with less steps and NO access to editing the Front Page Settings cog smile

This follows a "revoke" method. Instead of granting the Science teachers to edit the science label, and vice versa for Math, you instead prevent the Science teachers from editing all other labels on the front page, and vice versa for your other roles:

  1. Navigate to Site Admin – Users – Permissions – Define Roles: Make sure these permissions are set to N/A for the ‘Authenticated User on Front Page’ role and for the ‘Authenticated User’ role.
    • moodle/course:manageactivities
    • moodle/course:update
  2. Navigate to Front Page Settings (NOT under Site Admin) – Users – Permissions: verify these same two roles above are not listed under this “Roles with Permissions” column or the “Prohibited” column for the above two listed permissions.
  3. Navigate to Site Admin – Users – Permissions – Define Roles: Duplicate the Front Page role for each label you want a group to edit (i.e. if you want a Math Dept label and a Science Dept lable, then duplicate that role twice)
    • Click Define New Role
    • Select “Archetype: Authenticated user on front page” from the drop down & click Continue.
    •Give it a Short and Full name:
      (ie. Front Page Science Label / userfpsci)
      (Front Page Math Label / userfpmath)
    • Check of ‘System’ and ‘Activity Module’ under ‘Context where this role may be assigned’ – this way, you can add users to this role system wide and then assign this role to the label activity permissions on the front page
    ADD the following permission: moodle/course:manageactivites
    • Click the ‘Create this Role’ button
  4. Navigate to Site Admin – Users – Permissions – Assign System Roles: add the Science teachers to the Science front page role, and the Math teachers to the math front page role, etc…
  5. Go to the Front Page and add one label per department. Throw a title in the labels (ie. Science Label / Math Label).
  6. Click on the ‘Edit’ dropdown for the Science Label and select “Assign Roles” : you should now see Front Page Science Label as a listed role (it may say 0 users with this role for your 2 new roles, but if you click on the role, you’ll see your users are already assigned to it at the system level versus the activity level. You could always set it up so they are assigned at the activity level only, but your 2 new system roles don’t have any additional permissions so you are okay – the next step will take care of this).
  7. While in the same screen as step 6, click on “Permissions” in the Label admin block. If this is your Science label, then remove the following permission for
    ALL other groups you made.  

    • moodle/course:manageactivities
    Repeat for the Math label (remove the permission for the Science group).
    • If you have any other activities on the Front Page that you don't want these teachers to have editing access to, follow these same steps for the permissions of those individual activities to remove all of the new teacher groups from having the 'manage activity' rights.
  8. Now, log in as one user from each group and verify they can now edit the front page but for ONLY the label they were assigned to, no other label and no other activity on the front page.

John