Change moodle Theme as per user email address

Change moodle Theme as per user email address

por Baiju Sharma -
Número de respostas: 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.

Em resposta a 'Baiju Sharma'

Re: Change moodle Theme as per user email address

por Alexander Bias -
Foto de Core developers Foto de Peer reviewers Foto de 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

Em resposta a 'Baiju Sharma'

Re: Change moodle Theme as per user email address

por Ken Task -
Foto de 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


Em resposta a 'Baiju Sharma'

Re: Change moodle Theme as per user email address

por Richard Oelmann -
Foto de Core developers Foto de Particularly helpful Moodlers Foto de Plugin developers Foto de Testers

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

Em resposta a 'Richard Oelmann'

Re: Change moodle Theme as per user email address

por 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.