Different content for logged in Student than non-logged in

Different content for logged in Student than non-logged in

by Derek Chirnside -
Number of replies: 8

Is it possible in a theme to have extra material ONLY available after you have logged in on the home page, like even just a label?

Is it possible to add content (like a label) to a My home page?

-Derek

Average of ratings: -
In reply to Derek Chirnside

Re: Different content for logged in Student than non-logged in

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Derek,

My Shoehorn theme has a non-standard way of solving this though 'site pages'.  Site pages are global and can be set-up by the administrator to display content all the time or before or after login.  The pages are global so no enrollment and are automatically added to the footer menu.  They can additionally be filtered on language.  Thus possible to have different help pages and only have one shown for the language the user is using.  Plus each page can either be draft or published so that pages can be saved and worked on before going live.  You can place text and images on the page with the latter via the global 'image bank' functionality.  This is similar in concept to WordPress's media library.

The only drawback is once you change theme, you lose the ability.

Gareth

In reply to Derek Chirnside

Re: Different content for logged in Student than non-logged in

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

I use a custom theme based on one of Julian's original versions of Essential, with the user notices on the front page

I did some work to

a: also add that code to the MyHome page because thats what we use as the student's home page - we don't use the front page as we have a University portal anyway

b: create a second set of those notices in the settings pages which are staff only, so that on the layout file they are wrapped in a conditional if statement - for me that if statement detects whether they are staff (we have a different email format for staff and students so I use that as capabilities are course based and so wouldn't apply to frontpage/myHome) but that conditional could just check for isloggedin

Other ways of adding label like content to the MyHome page would be to use an HTML block and set it in the default MyHome page - that would be theme independent too.

In reply to Richard Oelmann

Re: Different content for logged in Student than non-logged in

by Derek Chirnside -

Thanks Richard, Mary and Gareth.

I have also found Evolve-D https://moodle.org/plugins/view.php?plugin=theme_evolved which has one of the sharpest and cleanest "logged in" home page experieinces I have seen.  Very very simple, it's just sad that it is all hard coded.  sad

Richard, you say "Other ways of adding label like content to the MyHome page would be to use an HTML block and set it in the default MyHome page - that would be theme independent too"
yes, point taken, I wanted it in the body of the page.


What do you think of this as a feature request:

My home: be able to add label or custom content in the page area.

-Derek.


In reply to Derek Chirnside

Re: Different content for logged in Student than non-logged in

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

You already can, thats why I suggested it - apologies for not clarifying that in my suggestion

Although the central region doesn't show as one to select in the settings of a block, it is an area you can drag blocks to on the MyHome page - the standard Course Overview that goes there is after all just a block.

This screenshot is More theme in 2.7

html block in central area of MyHome

In reply to Richard Oelmann

Re: Different content for logged in Student than non-logged in

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Yes - what Richard said, actually - it's how we do it on the My home pages of the School demo site - here's the demo student's Myhome page for example:


Average of ratings: Useful (1)
In reply to Derek Chirnside

Re: Different content for logged in Student than non-logged in

by Chris Kenniburg -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Derek,

In the new version of Evolve-D I have added the ability to control what icons, text, and links are used on the homepage.  So once you login you can now add up to 8 icons and links in the main navigation block/area.  

It will be released by the end of the week.  See the video and new documentation on the plugin page.  

https://moodle.org/plugins/view/theme_evolved

In reply to Derek Chirnside

Re: Different content for logged in Student than non-logged in

by Chris Kenniburg -
Picture of Particularly helpful Moodlers Picture of Plugin developers
If you download evolve-D and look at the layouts you will see how I pulled it off.  

In   layout / frontpage.php you will find the following:

<!-- Start frontpage on off toggle (Shows frontpage login and information box)-->

  <?php 

        if($PAGE->theme->settings->togglefp==1 && isloggedin()) {

            require_once(dirname(__FILE__).'/includes/fpcustom_lgin.php');

        } else if($PAGE->theme->settings->togglefp==2) {

            require_once(dirname(__FILE__).'/includes/fpnormal.php');

        } else if($PAGE->theme->settings->togglefp==1) {

            require_once(dirname(__FILE__).'/includes/fpcustom.php');

        } 

    ?>

I have 2 frontpages (custom and normal) and two different states (logged in and logged out).  This code either displays a nice login or a simplified custom homepage via a php insert.  Otherwise it will show the normal Moodle frontpage depending on a toggle in the theme admin.

Hope this helps.  Several people on here helped answer my questions and I was able to make my theme.  Best of luck.