Can I make the email optional ?

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
Marco Pereira
Registered User
Posts: 2
Joined: Mon Nov 25, 2002 9:21 pm

Can I make the email optional ?

Post by Marco Pereira » Mon Nov 25, 2002 9:28 pm

hi


I´m using the phpbb, for a local intranet site, but I have a
problem. Some off my users don´t have email account, and when they
try register email it´s obligatory. Can I make the email optional ?

Thanks in advance

Marco Pereira

User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact:

Solution...

Post by Balint » Thu Nov 28, 2002 12:30 pm

Hi Marco!

Maybe this could help you... I did _not_ test it yet, please report bugs etc.

Additionally you should set the "Enable account activation" in your Administation Panel to "None".

Code: Select all

############################################################## 
## MOD Title: Disable eMail requirement  
## MOD Version: 1.0.0 
## MOD Author: Balint < balint /at/ krizsan.de > (Balint Krizsan) http://www.krizsan.de 
## MOD Description: This MOD allows to disable the requirement of e-Mail addresses on registration 
## 
## Installation Level: easy 
## Installation Time: 5 Minutes 
## Files To Edit: includes/usercp_register.php, 
##                     templates/subSilver/profile_add_body.tpl, 
##                     templates/subSilver/profile_send_pass.tpl, 
##                     templates/subSilver/user_edit_body.tpl 
## Included Files: n/a 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ 
############################################################## 
## Author Note: 
## THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY 
## EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
## FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL 
## THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
## INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
## ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
##
## Revision History:	2002-11-28 - Version 1.0.0
##			- Initial Release
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ OPEN ]------------------------------------------ 
#
includes/usercp_register.php


# 
#-----[ FIND ]------------------------------------------ 
#
else if ( $mode == 'register' )
	{
		if ( empty($username) || empty($new_password) || empty($password_confirm) || 

empty($email) )


# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
else if ( $mode == 'register' )
	{
		if ( empty($username) || empty($new_password) || empty($password_confirm) )


# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/profile_add_body.tpl


# 
#-----[ FIND ]------------------------------------------ 
#
<td class="row1"><span class="gen">{L_EMAIL_ADDRESS}: *</span></td>


# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
<td class="row1"><span class="gen">{L_EMAIL_ADDRESS}:</span></td>


# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/profile_send_pass.tpl


# 
#-----[ FIND ]------------------------------------------ 
#
<td class="row1"><span class="gen">{L_EMAIL_ADDRESS}: *</span></td>


# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
<td class="row1"><span class="gen">{L_EMAIL_ADDRESS}:</span></td>


# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/user_edit_body.tpl


# 
#-----[ FIND ]------------------------------------------ 
#
<td class="row1"><span class="gen">{L_EMAIL_ADDRESS}: *</span></td>


# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
<td class="row1"><span class="gen">{L_EMAIL_ADDRESS}:</span></td>


# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
Regards,
Bálint

P.S. JetJam, do not steal my code again! :evil: You are _not_ allowed to modify it in any way!
Last edited by Balint on Sun Aug 22, 2004 7:48 pm, edited 1 time in total.

User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact:

Testing...

Post by Balint » Thu Nov 28, 2002 1:06 pm

Hi again!

I am currently testing, the MOD is not complete yet, I have to check some things in includes/functions_validate.php in the section function validate_email($email).

In a couple of hours I'll go on with this... please be patient... ;-)

Regards,
Bálint

User avatar
Balint
Registered User
Posts: 952
Joined: Tue Aug 06, 2002 2:19 pm
Location: Germany
Contact:

Small problems...

Post by Balint » Fri Nov 29, 2002 12:32 am

Hello again!

Could someone move this topic to "MOD requests"? I will visit my parents for a couple of days and can't solve the problem completely.

But the missing part is somewhere here in includes/functions_validate.php...

Code: Select all

//
// Check to see if email address is banned
// or already present in the DB
//
function validate_email($email)
{
	global $db, $lang;

	if ( $email != '' )
	{
		if ( preg_match('/^[a-z0-9\.\-_\+]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $email) )
		{
			$sql = "SELECT ban_email
				FROM " . BANLIST_TABLE;
			if ( $result = $db->sql_query($sql) )
			{
				while( $row = $db->sql_fetchrow($result) )
				{
					$match_email = str_replace('*', '.*?', $row['ban_email']);
					if ( preg_match('/^' . $match_email . '$/is', $email) )
					{
						return array('error' => true, 'error_msg' => $lang['Email_banned']);
					}
				}
			}

			$sql = "SELECT user_email
				FROM " . USERS_TABLE . "
				WHERE user_email = '" . str_replace("\'", "''", $email) . "'";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, "Couldn't obtain user email information.", "", __LINE__, __FILE__, $sql);
			}

			if ( $row = $db->sql_fetchrow($result) )
			{
				return array('error' => true, 'error_msg' => $lang['Email_taken']);
			}

			return array('error' => false, 'error_msg' => '');
		}
	}

	return array('error' => true, 'error_msg' => $lang['Email_invalid']);
}
Maybe we shouls define a "dummy" address like §@§.com on registration. But I cannot implement it due to WAMP-configuration problems at the moment... Maybe someone could help us?


Regards,
Bálint

Mr. Tech
Registered User
Posts: 2700
Joined: Tue Sep 24, 2002 4:49 am
Location: Nice and hot Australia
Contact:

Post by Mr. Tech » Fri Nov 29, 2002 1:06 am

One thing... If you make it optional you may not be able to send them Mass Emails, When they register they wont get an email with their account info... etc.. :?

Marco Pereira
Registered User
Posts: 2
Joined: Mon Nov 25, 2002 9:21 pm

Hi

Post by Marco Pereira » Fri Nov 29, 2002 3:43 pm

Thanks a lot for your help,
next week I will try your solutions, and them I wiil tell you someting.


Goog weekend !!!!

Kind regards :D
Marco Pereira

Locked

Return to “2.0.x Support Forum”