Setting the Ajax field to be set "yes" as default

Setting the Ajax field to be set "yes" as default

by Miki Alliel -
Number of replies: 5
Picture of Translators

I want to set the AJAX and Javascript field in of every user profile to be set as yes

and not as "no" which is the default now.

I want it to be set as "Yes" by default for every user's profile creation.

do I need to do something in the code? if so what and where?

thanks

Average of ratings: -
In reply to Miki Alliel

Re: Setting the Ajax field to be set "yes" as default

by Matt Campbell -
This can be done fairly easily in the database. Before making any changes, always back up the database so you'll have something to fall back on if you have any problems.

Assuming that you are using mdl_ as your database prefix, running the following SQL statement will make it so all new users will have AJAX turned on by default:

ALTER TABLE `mdl_user` CHANGE `ajax` `ajax` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1'

To turn on AJAX for all your existing users, use this statement:

UPDATE
`mdl_user` SET `ajax` = 1

Thanks,
Matt

In reply to Matt Campbell

תשובה ל: Re: Setting the Ajax field to be set "yes" as default

by Miki Alliel -
Picture of Translators

Hi thanks for the answer

before I try that - I want to be sure if it means that I'll see the "yes" selected already in the form of every profile user that I create or update??

thanks

In reply to Matt Campbell

תשובה ל: Re: Setting the Ajax field to be set "yes" as default

by Miki Alliel -
Picture of Translators

Hi

I tried the first query but as admin when I'm creating new user (in the form view of course) I see the ajax parameter selected as "no" and I want it to be "yes".

When I'm creating a new user (by email comfirmation, within the form) the parameter is set to "yes" (I can see that after signing in to the system and and edit the profile) but actually I need it when I'm adding users as admin to be set as "yes" too, because now it's set to be "no" as default from the admin point of view (when adding another user).

I Hope you understand and can help me.

Thanks

In reply to Miki Alliel

Re: תשובה ל: Re: Setting the Ajax field to be set "yes" as default

by Matt Campbell -
Looking at /user/editlib.php, it does look like the code overrides the default value you've set in the database, when an administrator creates a new user.

Search for:

$mform->setDefault('ajax', 0);

This is line 160 in Moodle 1.9 Beta 4 + (2007101508.08). Change the 0 to 1.

Thanks,
Matt
In reply to Matt Campbell

תשובה ל: Re: תשובה ל: Re: Setting the Ajax field to be set "yes" as default

by Miki Alliel -
Picture of Translators

Yes that What I meant

Thanks a lot