Change moodle Theme as per user email address

Change moodle Theme as per user email address

by Baiju Sharma -
Number of replies: 5

I would like to change Moodle theme as per user login.

Eg: If a student X login then moodle theme "magazine" should be shown to the user. If a student Y then moodle theme "aardvark" should be shown to the user.

I have installed both the theme in Moodle.

There is a column "theme" in a table called "mdl_user".

I have tried adding theme value into "mdl_user" table for a user, but no luck.

Thank you.

Average of ratings: -
In reply to Baiju Sharma

Re: Change moodle Theme as per user email address

by Alexander Bias -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Baiju,

you don't exactly describe how you want to decide which theme to deliver. You say that you want to change the theme based on the email address, but what's the exact decision?

If you have any possibility to decide which theme to choose based on a user's custom profile field value, this plugin might be for you: https://github.com/moodleuulm/moodle-local_profiletheme

Thanks,
Alex

In reply to Baiju Sharma

Re: Change moodle Theme as per user email address

by Ken Task -
Picture of Particularly helpful Moodlers

Not sure you can do this prior to login ... once logged on, however, then the users preference for a theme IF allowed to change themes is set at the user level.

Search your admin menu for "theme" and you should find the options for themes.

Direct manipulation of DB is never considered a solution ... or so I've read.

I can think of a couple of potential issues ...

1. once one sets up accounts via editing DB to a theme, what prevents them from changing the theme?   It's a user preference.   Guess you could hack the dashboard or whatever screen a student would see via css and hide the field for theme preference.  Once one starts down that road (hacking code) it could make your next update/upgrade more 'complicated'.

2. certain themes have special process should an update be needed.   While you as the admin user can accomplish those students cannot.   This to say, if a students theme goes wonky it might make support more complicated for you.

Others might know a way that's flawless ...  otherwise, my 2 cent advice ... it's your Moodle! ;)

'spirit of sharing', Ken


In reply to Baiju Sharma

Re: Change moodle Theme as per user email address

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

In Theme Settings, you will need to enable allowing user themes

Average of ratings: Useful (2)
In reply to Richard Oelmann

Re: Change moodle Theme as per user email address

by Baiju Sharma -

From where I will get the value or name of the theme which I will be adding associative to the user in mdl_user table in theme column.

In reply to Baiju Sharma

Re: Change moodle Theme as per user email address

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers
You can find the correct name to use for each theme in its version.php file