MyBB Community Forums

Full Version: email for registration?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
does anyone know how I would make it so that entering an email is optional for registration?
If you change the registration mode (Admin CP --> Settings --> Profile/Registration Options) to Instant Activation, users can enter in a bogus email address and it won't be checked.
DennisTT Wrote:If you change the registration mode (Admin CP --> Settings --> Profile/Registration Options) to Instant Activation, users can enter in a bogus email address and it won't be checked.

is there any way to allow them to not enter one at all? but make it optional
There is, but I would not recommend it. You may run into problems if MyBB tries to send email to people with no email address.

In inc/datahandlers/user.php, find:
		// Check if an email address has actually been entered.
		if(trim($user['email']) == '')
		{
			$this->set_error('missing_email');
			return false;
		}
Replace with:
		// Check if an email address has actually been entered.
		if(trim($user['email']) == '')
		{
			return true;
		}

In inc/functions.php, find:
	mail($to, $subject, $message, $headers);
Replace with:
	if(trim($to) != '')
	{
		mail($to, $subject, $message, $headers);
	}
DennisTT Wrote:There is, but I would not recommend it. You may run into problems if MyBB tries to send email to people with no email address.

In inc/datahandlers/user.php, find:
		// Check if an email address has actually been entered.
		if(trim($user['email']) == '')
		{
			$this->set_error('missing_email');
			return false;
		}
Replace with:
		// Check if an email address has actually been entered.
		if(trim($user['email']) == '')
		{
			return true;
		}

In inc/functions.php, find:
	mail($to, $subject, $message, $headers);
Replace with:
	if(trim($to) != '')
	{
		mail($to, $subject, $message, $headers);
	}



what sort of problems would you expect?
well the second modification should eliminate any PHP errors that may show up due to this. Your users may be confused if they subscribe to a thread/forum and not get an email, or opt to be notified for PM but they don't get any email.
DennisTT Wrote:There is, but I would not recommend it. You may run into problems if MyBB tries to send email to people with no email address.

In inc/datahandlers/user.php, find:
		// Check if an email address has actually been entered.
		if(trim($user['email']) == '')
		{
			$this->set_error('missing_email');
			return false;
		}
Replace with:
		// Check if an email address has actually been entered.
		if(trim($user['email']) == '')
		{
			return true;
		}

In inc/functions.php, find:
	mail($to, $subject, $message, $headers);
Replace with:
	if(trim($to) != '')
	{
		mail($to, $subject, $message, $headers);
	}


for the second modification
	mail($to, $subject, $message, $headers);
does not seem to exist in functions.php
It should be around line 370.

Although, which version of MyBB do you have?

Cheers,
CraKteR.
CraKteR Wrote:It should be around line 370.

Although, which version of MyBB do you have?

Cheers,
CraKteR.

I have the newest one with this change http://community.mybboard.net/showthread...7#pid95507
Then you should find the mail line.