MyBB Community Forums

Full Version: Control default user settings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'd like to be able to control the default user settings that are shown at registration. For example, I would like the "Email Notification" box to be checked by default.
You can do so by editing /inc/datahandlers/user.php

Find:
$this->verify_yesno_option($options, 'emailnotify', 'no');
The last column ('no') is the default option, so you can change it to 'yes' to make it on by default.
ZiNgA BuRgA Wrote:You can do so by editing /inc/datahandlers/user.php

Find:
$this->verify_yesno_option($options, 'emailnotify', 'no');
The last column ('no') is the default option, so you can change it to 'yes' to make it on by default.

Thank you! I'll try it out tomorrow morning!

-David
I made the change, so that this section of the user.php file looks like this:

function verify_options()
	{
		$options = &$this->data['options'];

		// Verify yes/no options.
		$this->verify_yesno_option($options, 'allownotices', 'yes');
		$this->verify_yesno_option($options, 'hideemail', 'no');
		$this->verify_yesno_option($options, 'emailnotify', 'yes');
		$this->verify_yesno_option($options, 'emailpmnotify', 'yes');
		$this->verify_yesno_option($options, 'receivepms', 'yes');
		$this->verify_yesno_option($options, 'pmpopup', 'yes');
		$this->verify_yesno_option($options, 'pmnotify', 'yes');
		$this->verify_yesno_option($options, 'invisible', 'no');
		$this->verify_yesno_option($options, 'remember', 'yes');
		$this->verify_yesno_option($options, 'dst', 'no');
		$this->verify_yesno_option($options, 'showsigs', 'yes');
		$this->verify_yesno_option($options, 'showavatars', 'yes');
		$this->verify_yesno_option($options, 'showquickreply', 'yes');
		$this->verify_yesno_option($options, 'showredirect', 'yes');

		if(isset($options['showcodebuttons']))

I uploaded it via ftp to the proper folder.

Next, I attempted to register as a new user. Unfortunately, the box for "Automatically subscribe to threads you post in." is still unchecked.

Did I do anything wrong? Is there a step I'm missing?
The above will not change the checkboxes on the registration page - they will merely set a default value if none is supplied to the userhandler.

If you want to make the checkbox checked by default, go to your AdminCP -> Templates -> Modify -> <expand your templateset> -> Member Templates -> member_register

Find:
{$emailnotifycheck}
And replace with:
checked="checked"

(note that this will have a slight side effect if the user fails to register, but nothing drastic)
ZiNgA BuRgA Wrote:The above will not change the checkboxes on the registration page - they will merely set a default value if none is supplied to the userhandler.

If you want to make the checkbox checked by default, go to your AdminCP -> Templates -> Modify -> <expand your templateset> -> Member Templates -> member_register

Find:
{$emailnotifycheck}
And replace with:
checked="checked"

(note that this will have a slight side effect if the user fails to register, but nothing drastic)

Ah. That makes more sense. What is the side effect if the user fails to register? Anything I need to be aware of?
No, nothing significant. Generally, if the user fails to register, they'll be brought back to the registration page, with the details they entered.

That is, if they unchecked the checkbox, when they fail to register, they should be brought back to the registration page with the checkbox unchecked. However, the above will force the checkbox to be checked when they fail to register, even if it's unchecked before.

You can think of it as a minor glitch - they can simply uncheck it again.