Howdy bsmither, I have made some adjustments to rklesla's code, and think it may be working like I think it should.
Code: Select all
#
#------[ SQL ]------------------------------------------------
#
# COMMENT: If using the following default_password, "Default Password, Please Change",
# you will have to increase pasword character limit to 32 charactaers.
#
# NOTE: If phpbb_ is not your database's prefix_ adjust accordingly.
#
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_password', 'Default Password, Please Change');
#
#------[ OPEN ]-----------------------------------------------
#
includes/acp/acp_add_user.php
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
/**
* acp_add_user
* New User Registration
* @package acp
*/
#
#------[ BEFORE, ADD ]----------------------------------------
#
# Tip: Add these lines on a new blank line before the preceding line(s) to find.
#
/**
* @ignore
* --------------------------
* Installed Modifications :
* --------------------------
* -- mod : default/add password for acp add user v.1.0.1 [rklesla] -------------
*/
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
$data = array(
#
#------[ BEFORE, ADD ]----------------------------------------
#
# Tip: Add these lines on a new blank line before the preceding line(s) to find.
#
//-- add mod : default/add password for acp add user v.1.0.1 [rklesla] ---------
$default_pass = $config['default_password'];
//-- end add : default/add password for acp add user v.1.0.1 [rklesla] ---------
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
'new_username' => utf8_normalize_nfc(request_var('username', '', true)),
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
//-- add mod : default/add password for acp add user v.1.0.1 [rklesla] ---------
'new_password' => request_var('new_password', '', true),
'password_confirm' => request_var('password_confirm', '', true),
//-- end add : default/add password for acp add user v.1.0.1 [rklesla] ---------
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
'bday_year' => request_var('bday_year', 0),
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
//-- add mod : default/add password for acp add user v.1.0.1 [rklesla] ---------
'default_password' => request_var('default_password', $default_pass),
//-- end add : default/add password for acp add user v.1.0.1 [rklesla] ---------
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
// lets create a wacky new password for our user...
$new_password = str_split(base64_encode(md5(time() . $data['new_username'])), $config['min_pass_chars'] + rand(3, 5));
#
#------[ REPLACE WITH ]---------------------------------------
#
# Tip: Replace the preceding line(s) to find with the following lines.
#
//-- mod replace : default/add password for acp add user v.1.0.1 [rklesla] -----
// lets create a wacky new password for our user...
// since we will no longer be creating a random password we comment the following lines...
// $new_password = str_split(base64_encode(md5(time() . $data['new_username'])), $config['min_pass_chars'] + rand(3, 5));
// $data['new_password'] = $new_password[0];
$new_password = $data['new_password'];
$password_confirm = $data['password_confirm'];
if($data['new_password'] == '')
{
$data['new_password'] == $default_pass;
}
else
{
$data['new_password'] == $new_password;
}
if($data['password_confirm'] == '')
{
$data['password_confirm'] == $default_pass;
}
else
{
$data['password_confirm'] == $password_confirm;
}
//-- end replace : default/add password for acp add user v.1.0.1 [rklesla] -----
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
'new_username' => array(
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
array('username')),
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
//-- add mod : default/add password for acp add user v.1.0.1 [rklesla] ---------
'new_password' => array(
array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
array('password')),
'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
//-- end add : default/add password for acp add user v.1.0.1 [rklesla] ---------
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
if (!sizeof($error))
{
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
//-- add mod : default/add password for acp add user v.1.0.1 [rklesla] ---------
if ($data['new_password'] != $data['password_confirm'])
{
$error[] = $user->lang['NEW_PASSWORD_ERROR'];
}
//-- end add : default/add password for acp add user v.1.0.1 [rklesla] ---------
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
$message[] = sprintf($user->lang['CONTINUE_EDIT_USER'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=profile&u=' . $user_id) . '">', $data['new_username'], '</a>');
#
#------[ BEFORE, ADD ]----------------------------------------
#
# Tip: Add these lines on a new blank line before the preceding line(s) to find.
#
//-- add mod : default/add password for acp add user v.1.0.1 [rklesla] ---------
$message[] = 'The new user\'s password is: ' . $data['new_password'];
//-- end add : default/add password for acp add user v.1.0.1 [rklesla] ---------
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
'NEW_USERNAME' => $data['new_username'],
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
//-- add mod : default/add password for acp add user v.1.0.1 [rklesla] ---------
'CONFIRM_PASSWORD' => $data['password_confirm'],
'DEFAULT_PASSWORD' => $data['default_password'],
'NEW_PASSWORD' => $data['new_password'],
//-- end add : default/add password for acp add user v.1.0.1 [rklesla] ---------
#
#------[ OPEN ]-----------------------------------------------
#
includes/acp/acp_board.php
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
/**
* @ignore
*/
#
#------[ REPLACE WITH ]---------------------------------------
#
# Tip: Replace the preceding line(s) to find with the following lines.
#
/**
* @ignore
* --------------------------
* Installed Modifications :
* --------------------------
* -- mod : default/add password for acp add user v.1.0.1 [rklesla] -------------
*/
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
'legend2' => 'WARNINGS',
'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
//-- add mod : default/add password for acp add user v.1.0.1 [rklesla] ---------
'legend3' => 'DEFAULT_PASSWORD',
'default_password' => array('lang' => 'DEFAULT_PASSWORD', 'validate' => 'string', 'type' => 'text:30:255', 'explain' => false),
//-- end add : default/add password for acp add user v.1.0.1 [rklesla] ---------
#
#------[ OPEN ]-----------------------------------------------
#
language/en/mods/info_acp_add_user_mod.php
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
/**
* @ignore
*/
#
#------[ REPLACE WITH ]---------------------------------------
#
# Tip: Replace the preceding line(s) to find with the following lines.
#
/**
* @ignore
* --------------------------
* Installed Modifications :
* --------------------------
* -- mod : default/add password for acp add user v.1.0.1 [rklesla] -------------
*/
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
'CONTINUE_EDIT_USER' => '%1$sClick here to the manage %2$s’s profile%3$s', // e.g.: Click here to edit Joe’s profile.
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
//-- add mod : default/add password for acp add user v.1.0.1 [rklesla] ---------
'DEFAULT_PASS' => 'Default Password',
'DEFAULT_PASS_CHANGE_EXPLAIN' => 'Password used for the add new user page.',
'DEFAULT_PASS_EXPLAIN' => 'Default password is already populated in the password fields.',
'DEFAULT_PASSWORD' => 'Default Password',
//-- end add : default/add password for acp add user v.1.0.1 [rklesla] ---------
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
'LOG_USER_ADDED' => '<strong>New user created</strong><br />» %s',
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
//-- add mod : default/add password for acp add user v.1.0.1 [rklesla] ---------
'PASSWORD_EXPLAIN' => 'Create new password if you decide not to use the default password as above.',
//-- end add : default/add password for acp add user v.1.0.1 [rklesla] ---------
#
#------[ OPEN ]-----------------------------------------------
#
adm/style/acp_add_user.html
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
<!-- IF ERROR -->
<div class="errorbox"><h3>{L_WARNING}</h3>
<p>{ERROR}</p>
</div>
<!-- ENDIF -->
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
<!-- Start mod : default/add password for acp add user v.1.0.1 -->
<fieldset>
<legend>{L_DEFAULT_PASS}</legend>
<dl>
<span>{L_DEFAULT_PASS_EXPLAIN}</span>
</dl>
<dl>
<dt><label for="default_pass">{L_DEFAULT_PASS}:</label></dt>
<dd>{DEFAULT_PASSWORD}</dd>
</dl>
</fieldset>
<!-- Finish mod : default/add password for acp add user v.1.0.1 -->
#
#------[ FIND ]-----------------------------------------------
#
# Tip: This may be a partial find and not the whole line.
#
<dd><input class="medium" type="text" id="username" name="username" size="25" maxlength="40" value="{NEW_USERNAME}" /></dd>
</dl>
#
#------[ AFTER, ADD ]-----------------------------------------
#
# Tip: Add these lines on a new blank line after the preceding line(s) to find.
#
<!-- Start mod : default/add password for acp add user v.1.0.1 -->
<!-- IF DEFAULT_PASSWORD -->
<dl>
<dt><label for="new_password">{L_NEW_PASSWORD}: *</label><br /><span>{L_PASSWORD_EXPLAIN}</span></dt>
<dd><input type="password" name="new_password" id="new_password" size="25" maxlength="255" value="{DEFAULT_PASSWORD}" class="inputbox" title="{L_CHANGE_PASSWORD}" /></dd>
</dl>
<dl>
<dt><label for="password_confirm">{L_CONFIRM_PASSWORD}: *</label><br /><span>{L_CONFIRM_PASSWORD_EXPLAIN}</span></dt>
<dd><input type="password" name="password_confirm" id="password_confirm" size="25" maxlength="255" value="{DEFAULT_PASSWORD}" class="inputbox" title="{L_CONFIRM_PASSWORD}" /></dd>
</dl>
<!-- ELSE NEW_PASSWORD -->
<dl>
<dt><label for="new_password">{L_NEW_PASSWORD}: *</label><br /><span>{L_PASSWORD_EXPLAIN}</span></dt>
<dd><input type="password" name="new_password" id="new_password" size="25" maxlength="255" value="{NEW_PASSWORD}" class="inputbox" title="{L_CHANGE_PASSWORD}" /></dd>
</dl>
<dl>
<dt><label for="password_confirm">{L_CONFIRM_PASSWORD}: *</label><br /><span>{L_CONFIRM_PASSWORD_EXPLAIN}</span></dt>
<dd><input type="password" name="password_confirm" id="password_confirm" size="25" maxlength="255" value="{CONFIRM_PASSWORD}" class="inputbox" title="{L_CONFIRM_PASSWORD}" /></dd>
</dl>
<!-- ENDIF -->
<!-- Finish mod : default/add password for acp add user v.1.0.1 -->
#
#------[ DIY INSTRUCTIONS ]-----------------------------------
#
# Tip : These are manual instructions that cannot be performed automatically.
# You should follow these instructions carefully.
#
At the Administration Control Panel "Purge" the cache.
#
#------[ SAVE/CLOSE ALL FILES/UPLOAD/ENJOY !!! ]--------------------------------
#
# EoM
#
# You have finished the installation for this MOD.
# Upload all changed files to your website.
# If the installation went bad, simply restore your backed up files.
#
# EoF
# ..:: -= END =- ::..