General developer forum

Custom Login Page in Moodle 3.2 with Clean Theme

Picture of Nicolas Dunand
Re: Custom Login Page in Moodle 3.2 with Clean Theme
Core developersParticularly helpful MoodlersPlugin developers

Hi Raad,

I came across your post a couple hours ago as I was struggling with the same issues.

I now have a working custom theme using a Mustache template for the login page.

Here's what I discovered :

  1. I had to override render_login() in my theme's theme/mytheme/classes/core_renderer.php to add whatever template variables I needed to the template context
  2. I somehow only had to use theme/mytheme/templates/core/login.mustache

I hope this helps.

Average of ratings: Useful (1)
Picture of Raad Al-Rawi
Re: Custom Login Page in Moodle 3.2 with Clean Theme

Hi Nicolas

Thanks for taking the time to post. I pretty much discovered the answer around the same time you did (whoa!), only I didn't override render_login(), I just stuck with my original mytheme/view/login.php script in order to set the variables.

As a result, I found I could use certain vars in the core template, and others in the non-core template, so with a bit of fiddling I managed to do what I wanted to; but I think you are right, having your own core_renderer is much better as you can incorporate logic there better than in the view script, and certainly better than in the mustache template!



Average of ratings: -