email as username

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
shunluoi
Registered User
Posts: 2
Joined: Mon Apr 02, 2007 2:45 pm

email as username

Post by shunluoi »

I've been searching around for this but haven't found anything...sorry if I'm missing it.

I would like to run a phpBB forum that requires the email address to be the username. So when someone registers, they only have to enter their email address and a password (and maybe their name, but not necessary).

Does this MOD exist? If not, I would love to see it...or if it is easy to do myself would love some direction from anyone!

Thanks!
alexi02
Registered User
Posts: 271
Joined: Fri Mar 05, 2004 2:15 am
Location: Australia
Contact:

Re: email as username

Post by alexi02 »

This should do it.

Code: Select all

##############################################################
## MOD Title: Use Email as Username
## MOD Author: alexi02 < N/A > (Alejandro Iannuzzi) http://www.uzzisoft.com
## MOD Description: When registering, the email address field is inserted as the users username.
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 3 Minutes
## Files To Edit: includes/usercp_register.php
##                templates/subSilver/profile_add_body.tpl
## Included Files: N/A
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
##      Removes the username field.
##      The user's email address will be the user's username.
##
##############################################################
## MOD History:
##
##  2007-04-03 - Version 1.0.0
##      - Initial Release (for phpBB 2.0.22)
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#

includes/usercp_register.php

#
#-----[ FIND ]------------------------------------------
#

        $username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';

#
#-----[ REPLACE WITH ]------------------------------------------
#

        $username = ( !empty($HTTP_POST_VARS['email']) ) ? phpbb_clean_username($HTTP_POST_VARS['email']) : '';

#
#-----[ FIND ]------------------------------------------
#

        if ( ($mode == 'register') || ($board_config['allow_namechange']) )
        {
                $template->assign_block_vars('switch_namechange_allowed', array());
        }
        else
        {
                $template->assign_block_vars('switch_namechange_disallowed', array());
        }

#
#-----[ REPLACE WITH ]------------------------------------------
#

        if ( $mode == 'register' )
        {
                $template->assign_block_vars('switch_namechange_disallowed', array());
        }

        else if ( $board_config['allow_namechange'] )
        {
                $template->assign_block_vars('switch_namechange_allowed', array());
        }

#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/profile_add_body.tpl

#
#-----[ FIND ]------------------------------------------
#

        <!-- BEGIN switch_namechange_disallowed -->
        <tr>
                <td class="row1" width="38%"><span class="gen">{L_USERNAME}: *</span></td>
                <td class="row2"><input type="hidden" name="username" value="{USERNAME}" /><span class="gen"><b>{USERNAME}</b></span></td>
        </tr>
        <!-- END switch_namechange_disallowed -->

#
#-----[ REPLACE WITH ]------------------------------------------
#

#
#-----[ FIND ]------------------------------------------
#

                <td class="row1"><span class="gen">{L_EMAIL_ADDRESS}: *</span></td>

#
#-----[ REPLACE WITH ]------------------------------------------
#

                <td class="row1" width="38%"><span class="gen">{L_EMAIL_ADDRESS}: *</span></td>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Post Reply

Return to “[2.0.x] MOD Requests”