[RC] Forgot Username (MMW)

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
kkroo
Registered User
Posts: 729
Joined: Sat Dec 03, 2005 4:49 pm
Contact:

[RC] Forgot Username (MMW)

Post by kkroo »

MOD Title: Forgot Username (MMW)

MOD Description: Functionality that allows a user to retrieve a forgotten username.

MOD Version
: 1.0.0

MOD Download: http://phpbb-login.sourceforge.net/foru ... file_id=18
My MODs

Need a coder?

Enjoy my Mods? - Image
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

Screenshot?
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three
jupro
Registered User
Posts: 273
Joined: Sat Jun 12, 2004 8:26 am

Post by jupro »

hi there,

in the install file for this mod it says,
Included Files: N/A
, but there are actually included files.

A little confused, do I need to upload these files as well?

It would seem so.

Thanks very much.
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

jupro: Yes, those files have to be uploaded. kkroo forgot to add them.

The MOD installed fine with easymod, but you need to add instructions about the included files (COPY). Here's a screenshot of the MOD:

Image Image

This part (profile_send_pass.tpl):

Code: Select all

<br /><a href="{U_FORGOT_USERNAME}">{L_FORGOT_USERNAME}</a>
Should be like this:

Code: Select all

<br /><span class="gensmall"><a href="{U_FORGOT_USERNAME}">{L_FORGOT_USERNAME}</a></span>
I'd rather add a "I forgot my username" link on the login page. It's easier to find.
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three
sbourdon
Registered User
Posts: 174
Joined: Sat Nov 13, 2004 6:29 pm

Post by sbourdon »

Hello,

MOD had a couple of errors in it and was incompatible with Smart Login Redirect (http://smartor.is-root.com/viewtopic.php?t=2716). Therefore, I've modified it a bit: no need to reactivate account, reminder link now on the login page and french version also included!

Here's my updated version:

Code: Select all

# 
#----[ OPEN ]------------------------------------------- 
# 
   ROOT/language/lang_french/lang_main.php

#
#-----[ FIND ]------------------------------------------ ("J'ai oublié mon nom d'utilisateur / mot de passe")
# 
# Note: this is a partial find
# 
$lang['Password_activated']

#
#-----[ AFTER, ADD ]------------------------------------------ ("J'ai oublié mon nom d'utilisateur / mot de passe")
# 
//
// user reminder mod (MMW)
//
$lang['User_reminder_sent'] = 'Un rappel de votre nom d\'utilisateur vous a été envoyé par courriel. Veuillez vérifier votre boîte de courriels pour de plus amples informations.';
$lang['Send_username'] = 'Envoyez-moi un rappel de mon nom d\'utilisateur';
$lang['Username_reminder'] = 'Rappel du nom d\'utilisateur';
$lang['Forgot'] = 'J\'ai oublié mon ';

#
#-----[ OPEN ]------------------------------------------
#
   ROOT/language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------ ("J'ai oublié mon nom d'utilisateur / mot de passe")
# 
# Note: this is a partial find
# 
$lang['Password_activated']

#
#-----[ AFTER, ADD ]------------------------------------------ ("J'ai oublié mon nom d'utilisateur / mot de passe")
# 
//
// user reminder mod (MMW)
//
$lang['User_reminder_sent'] = 'Your username reminder email has successfully been sent. Please check your e-mail for further information';
$lang['Send_username'] = 'Send username reminder email';
$lang['Username_reminder'] = 'Username reminder';
$lang['Forgot'] = 'I forgot my ';

#
#-----[ OPEN ]------------------------------------------
#
   ROOT/templates/subSilver/login_body.tpl

#
#-----[ FIND ]------------------------------------------ ("J'ai oublié mon nom d'utilisateur / mot de passe")
#
			<td colspan="2"><span class="gensmall"><a href="{U_SEND_PASSWORD}" class="gensmall">{L_SEND_PASSWORD}</a></span></td>

#
#-----[ REPLACE WITH ]------------------------------------------ ("J'ai oublié mon nom d'utilisateur / mot de passe")
#
			<td colspan="2"><span class="gensmall">{L_FORGOT}<a href="{U_FORGOT_USERNAME}" class="gensmall">{L_USERNAME}</a> / <a href="{U_SEND_PASSWORD}" class="gensmall">{L_PASSWORD}</a></span></td>

#
#-----[ OPEN ]--------------------------------------------
#
   ROOT/includes/page_header.php

#
#-----[ FIND ]--------------------------------------------- ("J'ai oublié mon nom d'utilisateur / mot de passe")
# 
	'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'),

# 
#-----[ AFTER, ADD ]--------------------------------------- ("J'ai oublié mon nom d'utilisateur / mot de passe")
# 
	'L_FORGOT' => $lang['Forgot'],	
	
	'U_FORGOT_USERNAME' => append_sid("profile.$phpEx?mode=sendusername"),
	'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),

#
#-----[ OPEN ]------------------------------------------
#
   ROOT/profile.php
   
#
#-----[ FIND ]------------------------------------------ ("J'ai oublié mon nom d'utilisateur / mot de passe")
# 
	else if ( $mode == 'sendpassword' )
	{
		include($phpbb_root_path . 'includes/usercp_sendpasswd.'.$phpEx);
		exit;
	}

#
#-----[ AFTER, ADD ]------------------------------------------ ("J'ai oublié mon nom d'utilisateur / mot de passe")
# 
	//
	// user reminder mod (MMW)
	//
	else if ( $mode == 'sendusername' )
	{
		include($phpbb_root_path . 'includes/usercp_sendusername.'.$phpEx);
		exit;
	}
ROOT/includes/ usercp_sendusername.php

Code: Select all

<?php
/***************************************************************************
 *                           usercp_sendusername.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: usercp_sendusername.php,v 1.6.2.13 2005/09/14 18:14:30 acydburn Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
	die('Hacking attempt');
	exit;
}

if ( isset($HTTP_POST_VARS['submit']) )
{
	$email = ( !empty($HTTP_POST_VARS['email']) ) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : '';

	$sql = "SELECT user_id, username, user_email, user_active, user_lang 
		FROM " . USERS_TABLE . " 
		WHERE user_email = '" . str_replace("\'", "''", $email) . "'";
	if ( $result = $db->sql_query($sql) )
	{
		if ( $row = $db->sql_fetchrow($result) )
		{
			if ( !$row['user_active'] )
			{
				message_die(GENERAL_MESSAGE, $lang['No_send_account_inactive']);
			}

			$username = $row['username'];
			$user_id = $row['user_id'];

			include($phpbb_root_path . 'includes/emailer.'.$phpEx);
			$emailer = new emailer($board_config['smtp_delivery']);

			$emailer->from($board_config['board_email']);
			$emailer->replyto($board_config['board_email']);

			$emailer->use_template('user_username_reminder', $row['user_lang']);
			$emailer->email_address($row['user_email']);
			$emailer->set_subject($lang['Username_reminder']);

			$emailer->assign_vars(array(
				'SITENAME' => $board_config['sitename'], 
				'USERNAME' => $username,
				'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '') 
			);
			$emailer->send();
			$emailer->reset();

			$template->assign_vars(array(
				'META' => '<meta http-equiv="refresh" content="15;url=' . append_sid("index.$phpEx") . '">')
			);

			$message = $lang['User_reminder_sent'] . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');

			message_die(GENERAL_MESSAGE, $message);
		}
		else
		{
			message_die(GENERAL_MESSAGE, $lang['No_email_match']);
		}
	}
	else
	{
		message_die(GENERAL_ERROR, 'Could not obtain user information for sendusername', '', __LINE__, __FILE__, $sql);
	}
}
else
{
	$email = '';
}

//
// Output basic page
//
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'profile_send_user.tpl')
);
make_jumpbox('viewforum.'.$phpEx);

$template->assign_vars(array(
	'EMAIL' => $email,

	'L_SEND_USERNAME' => $lang['Send_username'], 
	'L_ITEMS_REQUIRED' => $lang['Items_required'],
	'L_EMAIL_ADDRESS' => $lang['Email_address'],
	'L_SUBMIT' => $lang['Submit'],
	'L_RESET' => $lang['Reset'],
	
	'S_HIDDEN_FIELDS' => '', 
	'S_PROFILE_ACTION' => append_sid("profile.$phpEx?mode=sendusername"))
);

$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>
ROOT/language/lang_english/email/user_username_reminder.tpl

Code: Select all

Subject: Username reminder
Charset: iso-8859-1

Hello,

You are receiving this email because you have (or someone pretending to be you has) requested the username for your account on {SITENAME}. If you did not request this email then please ignore it, if you keep receiving it please contact the board administrator.

Username: {USERNAME}

If you have any difficulties please contact the board administrator.

{EMAIL_SIG}
ROOT/language/lang_french/email/user_username_reminder.tpl

Code: Select all

Subject: Rappel du nom d'utilisateur
Charset: iso-8859-1

Bonjour,

Vous recevez ce courriel parce que vous avez (ou quelqu'un qui prétend être vous) demandé à ce que votre nom d'utilisateur vous soit envoyé pour votre compte sur {SITENAME}. Si vous n'avez pas demandé ce courriel, veuillez l'ignorer. Si vous continuez à le recevoir, veuillez contacter l'administrateur du forum.

Nom d'utilisateur: {USERNAME}

Si vous rencontrez des difficultés, veuillez contacter l'administrateur du forum.

{EMAIL_SIG}
ROOT/templates/subSilver/profile_send_user.tpl (UNCHANGED)

Code: Select all

<form action="{S_PROFILE_ACTION}" method="post">
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
  <tr> 
	<td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
  </tr>
</table>
  <table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
	<tr> 
	  <th class="thHead" colspan="2" height="25" valign="middle">{L_SEND_USERNAME}</th>
	</tr>
	<tr> 
	  <td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td>
	</tr>
	<tr> 
	  <td class="row1"><span class="gen">{L_EMAIL_ADDRESS}: *</span></td>
	  <td class="row2"> 
		<input type="text" class="post" style="width: 200px" name="email" size="25" maxlength="255" value="{EMAIL}" />
	  </td>
	</tr>
	<tr> 
	  <td class="catBottom" colspan="2" align="center" height="28">{S_HIDDEN_FIELDS} 
		<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" />
		&nbsp;&nbsp; 
		<input type="reset" value="{L_RESET}" name="reset" class="liteoption" />
	  </td>
	</tr>
  </table>
</form>
Hope you'll like it! :wink:
sangai
Registered User
Posts: 1
Joined: Wed Aug 09, 2006 6:55 am

Post by sangai »

i got problem when click the link 'forget username'. The link drive me back to my forum index page. It seem like the usercp_sendusername.php didn't exist. But, i already copy all the include files to my server. Is there any solution??
aboima
Registered User
Posts: 275
Joined: Sat Jul 29, 2006 3:01 am

Post by aboima »

shangai did you finally resolve this? as i am looking to apply the MOD also and need to know if it works without errors

Andrew
User avatar
Elias
Registered User
Posts: 5136
Joined: Sat Feb 25, 2006 4:31 pm
Location: In the Water!
Name: Elias

Post by Elias »

Thanks for the screenies eviL<3.

Great MOD you got there kkroo.
"Mystery creates wonder, and wonder is the basis of man's desire to understand." - Neil Armstrong
|Installing Extensions|Writing Extensions|Extension Validation Policy|
Offering private web hosting. Contact me for details.
hostyorkshire
Registered User
Posts: 25
Joined: Mon Oct 04, 2004 7:53 pm

Post by hostyorkshire »

Hiya all! Did this mod actually work, or is there another one someone can direct me to? I'm having the same problem, users not remembering their usernames :? and it's getting quite tedious looking them up in the mySQl database from their email address.

Hope you are all well!

Andrew
sbourdon
Registered User
Posts: 174
Joined: Sat Nov 13, 2004 6:29 pm

Post by sbourdon »

hostyorkshire wrote: Hiya all! Did this mod actually work, or is there another one someone can direct me to? I'm having the same problem, users not remembering their usernames :? and it's getting quite tedious looking them up in the mySQl database from their email address.

Hope you are all well!

Andrew


MOD works like a charm!
You may want to have a look at the modifications I've made a couple of posts above this one... ;)

Cheers!
theon22
Registered User
Posts: 2
Joined: Mon Apr 30, 2007 11:33 am

Re: [RC] Forgot Username (MMW)

Post by theon22 »

I can't get this mod to show up in my Easymod folder can someone help me?
sbourdon
Registered User
Posts: 174
Joined: Sat Nov 13, 2004 6:29 pm

Re: [RC] Forgot Username (MMW)

Post by sbourdon »

theon22 wrote: I can't get this mod to show up in my Easymod folder can someone help me?


Unfortunately, this MOD is NOT EM compliant; you'll have to install it manually.
theon22
Registered User
Posts: 2
Joined: Mon Apr 30, 2007 11:33 am

Re: [RC] Forgot Username (MMW)

Post by theon22 »

N/m i got it forgot to copy the files :D
User avatar
jrdorkin
Registered User
Posts: 45
Joined: Fri Jun 18, 2004 6:32 am
Location: Denver, CO
Contact:

Re: [RC] Forgot Username (MMW)

Post by jrdorkin »

Just curious . . . what happens if someone puts the admin email address into this mod? Does it deactivate the admin account as well? It could be a pain in the A#$ if someone wants to mess with the admin . . .

Thoughts?
sbourdon
Registered User
Posts: 174
Joined: Sat Nov 13, 2004 6:29 pm

Re: [RC] Forgot Username (MMW)

Post by sbourdon »

jrdorkin wrote:Just curious . . . what happens if someone puts the admin email address into this mod? Does it deactivate the admin account as well? It could be a pain in the A#$ if someone wants to mess with the admin . . .

Thoughts?
Use my fixed version, above: http://www.phpbb.com/community/viewtopi ... 0#p2332060
You won't have that problem anymore! ;)
Post Reply

Return to “[2.0.x] MODs in Development”