Custom pages are not displaying after login

Custom pages are not displaying after login

by Rajakumar Jillella -
Number of replies: 12

I'm using Moodle 3.0.1.


Custom pages are displaying before login,

And custom pages are not displaying once the user logged in.


How do we display custom pages after logged in too?


Average of ratings: -
In reply to Rajakumar Jillella

Re: Custom pages are not displaying after login

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi, 

I am intregued to find out how you created the Custom pages? And also how you added them? 

Cheers

Mary

In reply to Mary Evans

Re: Custom pages are not displaying after login

by Rajakumar Jillella -

Hi Mary,


Step - 1

I installed klass theme and created a custom file like contact.php and placed in root folder.

included header & footer files using the following code.

include('config.php');

echo $OUTPUT->header();

echo "Contact Content Here";

echo $OUTPUT->footer();


Step - 2

Site Administrator -> Appearance -> Themes -> Theme Settings

Menu item name "Contact Us" added in the block "Custom Menu Items" and given url

ex :- Contact Us|http://localhost:8080/yoursite/contact.php


That's it,

But, Those created pages are not displaying after login.

Please let me know if you get the solution on this.


Thanks in Advance

In reply to Rajakumar Jillella

Re: Custom pages are not displaying after login

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

Please see the answers to your other very similar question, which gives two alternative methods for creating theses pages

1. Using the page api (best if you are creating a page for distribution with a theme or other plugin)

2. Creating a front-page Page resource (best if you are adding content to a specific site)

https://moodle.org/mod/forum/discuss.php?d=327867#p1318685

In reply to Rajakumar Jillella

Re: Custom pages are not displaying after login

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

What you are attempting to do is complex.  The only theme I know that does such a thing outside of core pages is Shoehorn and that took me ages to work out.  The pages here: https://github.com/gjb2048/moodle-theme_shoehorn/tree/master/pages are linked to and then have their own page layout: https://github.com/gjb2048/moodle-theme_shoehorn/blob/master/config.php#L198-L203.  The content comes from the theme settings - long story - look at the code for inspiration.

In reply to Rajakumar Jillella

Re: Custom pages are not displaying after login

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

I would be more inclined to create a page via Moodle as a Resource, that way it works like any other page in Moodle.

Average of ratings: Useful (1)
In reply to Mary Evans

Re: Custom pages are not displaying after login

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

For this use - of a page in one site, I compleltely agree with Mary, as she has already said this in another thread, and which again highlights the need not to be cross posting the same issue in multiple places smile

In reply to Richard Oelmann

Re: Custom pages are not displaying after login

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

Of course there is always integrating with Wordpress for site wide static pages - like moodle.org.

In reply to Gareth J Barnard

Re: Custom pages are not displaying after login

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

Did you mean moodle.net, Gareth? I didn't think the .org site used WP anywhere (although I believe it does use mediawiki for the docs pages)