Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2010-12-15 09:25:25

Lozit
Member
Registered: 2010-12-05
Posts: 6

[MOD] User Management

Hello, i just released this mod.
If you're experiencing problems or want to talk about this mod or potential improvements, you are welcomed.

This mod provides two additional user management functions :

- user pruning which involves deleting users over a certain number of days old and with less than a number of posts.
- create users from admin panel

Available language : english, french, russian, german

French discussion here : http://fluxbb.fr/forums/viewtopic.php?id=11474
Download here : http://fluxbb.org/resources/mods/user-management/

Readme :

##        Mod title:  User Management
##
##      Mod version:  1.4
##  Works on FluxBB:  1.4
##     Release date:  2010-12-05
##
##          Authors:  Guillaume Ferrari (guillaume.ferrari@gmail.com) for 1.4
##                      with the help of Quy Ton (quy@fluxbb.org)
##                    Connor Dunn (Connorhd@mypunbb.com) for previous versions
##
##     Contributors:  Maximilien Thiel (www.thiel.fr) for French Version
##                         Smartrope/Cyber-Hipp for Russian translation
##                         Cyberman for German translation
##
##      Description:  Manage Users
##
##   Affected files:  None
##
##       Affects DB:  No
##
##            Notes:  This mod provides two additional user management functions :
##                    - user pruning which involves deleting users over a certain 
##                      number of days old and with less than a number of posts. 
##                    - create users from admin panel

Last edited by Lozit (2011-07-27 07:10:32)

Offline

#2 2011-02-10 23:36:03

SmartRope
Member
From: ...deep junkcity of Russia.
Registered: 2011-02-10
Posts: 6
Website

Re: [MOD] User Management

Hi! I`ve made russian translation of this mod. It was succesfully tested on FluxBB v1.4.4. Can you upload it to repository?

Last edited by SmartRope (2011-02-10 23:52:57)

Offline

#3 2011-02-11 02:43:47

Jack
Member
Registered: 2010-12-24
Posts: 485
Website

Re: [MOD] User Management

SmartRope wrote:

Hi! I`ve made russian translation of this mod. It was succesfully tested on FluxBB v1.4.4. Can you upload it to repository?

There is not "repository" for the plugin. You could ask the plugin developer to include the translation in the next plugin release.

J wink


Sorry I don't speak English smile
FluxBB Italy

Offline

#4 2011-02-11 07:43:12

Lozit
Member
Registered: 2010-12-05
Posts: 6

Re: [MOD] User Management

Hello SmartRope, i will add your translation, i will send you a mail now smile
Thanks for your help.

Offline

#5 2011-02-11 08:46:04

ezhik
Member
Registered: 2011-02-10
Posts: 1
Website

Re: [MOD] User Management

SmartRope wrote:

Hi! I`ve made russian translation of this mod. It was succesfully tested on FluxBB v1.4.4. Can you upload it to repository?

Thank you! [Спасибо за перевод!]

Offline

#6 2011-02-11 09:04:42

cyberman
Member
From: Germany
Registered: 2010-01-11
Posts: 297
Website

Re: [MOD] User Management

SmartRope wrote:

Hi! I`ve made russian translation of this mod. It was succesfully tested on FluxBB v1.4.4. Can you upload it to repository?

Hello, here comes the german translation of this mod - maybe you want to add it wink.

Offline

#7 2011-02-11 09:55:12

Lozit
Member
Registered: 2010-12-05
Posts: 6

Re: [MOD] User Management

Thanks Cyberman, i will add it !

Offline

#8 2011-07-27 07:12:56

Lozit
Member
Registered: 2010-12-05
Posts: 6

Re: [MOD] User Management

I just added German and Russian into a new release.

Offline

#9 2011-09-16 10:47:57

Donny Bahama
Member
Registered: 2011-05-15
Posts: 9

Re: [MOD] User Management

When users are added from the admin panel, does it send them an email?

Offline

#10 2011-09-16 11:58:20

Lozit
Member
Registered: 2010-12-05
Posts: 6

Re: [MOD] User Management

If you choose a random password for the user, an email will be sent with the password.
If you prefer to enter a password yourself, then no email is sent.

Offline

#11 2011-09-19 22:04:32

Donny Bahama
Member
Registered: 2011-05-15
Posts: 9

Re: [MOD] User Management

Perfect. Thank you for this - it works perfectly!

Offline

#12 2013-05-17 04:30:08

ehtime
Member
Registered: 2009-06-18
Posts: 137
Website

Re: [MOD] User Management

Simplified Chinese:

<?php

// Language definitions used in the user management 
$lang_user_management = array(
    
'Days must be integer message'      => '天数必须设置为一个正整数值。',
'Posts must be integer message'     => '帖子数必须设置为一个正整数值。',
'Pruning complete message'          => '清理完毕。清理用户数: %s',
'User created message'              => '用户添加已完成',
'User management - v'               => 'User management - v',
'Plugin prune info'                 => '该插件允许你根据用户的活跃时间及发帖数量来清理用户。',
'Plugin warning'                    => '警告:该功能在执行后将会立即生效且无法恢复。请谨慎使用(建议在执行前作好数据备份)。',
'Plugin add info'                   => '该插件还允许你手动添加用户。当你已关闭了论坛的注册功能时,该功能尤其实用。',
'User prune head'                   => '清理用户',
'Settings subhead'                  => '设置',
'Prune by label'                    => '清理条件',
'Prune help'                        => '选择判断依据,自注册日期还是最近登录计算天数。',
'Registered date'                   => '注册日期',
'Last login'                        => '最近登录',
'Minimum days label'                => '注册/登录已过天数',
'Minimum days help'                 => '注册时间已超过所填天数,或已超过所填天数未登录的用户将被清理。',
'Maximum posts label'               => '发帖数小于',
'Maximum posts help'                => '发帖数小于所填数目的用户方会被清理。例如,若填写 1 则仅清理从未发帖的用户。',
'Delete admins and mods label'      => '包括管理员和版主',
'Delete admins and mods help'       => '启用时,符合条件的管理员和版主将同时被清理。',
'User status label'                 => '用户验证状态',
'User status help'                  => '选择所要清理之用户的验证状态。',
'Delete any'                        => '清理全部',
'Delete only verified'              => '仅清理已验证者',
'Delete only unverified'            => '仅清理尚未验证者',
'Add user head'                     => '添加用户',
'Generate random password label'    => '随机密码',
'Generate random password help'     => '若使用随机密码,一个随机生成的密码将会发送到以上电子信箱。',
'Password help'                     => '如果不使用随机密码,请指定一个密码。',

);

Offline

#13 2013-06-22 09:31:14

harnser
Member
Registered: 2012-10-31
Posts: 19

Re: [MOD] User Management

This mod is an essential part of my forum, so a big thanks to Lozit!!!

However, I do have one small problem with it.  When I add a user, I always select 'Yes' for the 'Generate random password' option.  This generates an email to the admin mailing list (just me), but the email has no subject and the body only contains '--'.  Why is this?  TIA!

Offline

#14 2013-08-14 20:30:26

adaur
Developer
From: France
Registered: 2010-01-07
Posts: 843
Website

Re: [MOD] User Management

Updated: https://fluxbb.org/resources/mods/user- … ses/1.5.0/

qYXhOPUYEt.png

Last edited by adaur (2013-08-14 20:31:55)


FeatherBB - A simple and lightweight new generation forum system
Based on FluxBB, written in PHP, using Slim Framework for a proper OOP-MVC architecture.

Offline

#15 2014-02-04 14:39:30

harnser
Member
Registered: 2012-10-31
Posts: 19

Re: [MOD] User Management

harnser wrote:

This mod is an essential part of my forum, so a big thanks to Lozit!!!

However, I do have one small problem with it.  When I add a user, I always select 'Yes' for the 'Generate random password' option.  This generates an email to the admin mailing list (just me), but the email has no subject and the body only contains '--'.  Why is this?  TIA!

I never got to the bottom of this issue...  Can anyone help, please?   I'm using FluxBB v1.5.6 and User management v1.5.0.  TIA!!!

Offline

#16 2014-12-15 13:53:55

signuprepli
Member
Registered: 2014-11-05
Posts: 65

Re: [MOD] User Management

harnser wrote:
harnser wrote:

This mod is an essential part of my forum, so a big thanks to Lozit!!!

However, I do have one small problem with it.  When I add a user, I always select 'Yes' for the 'Generate random password' option.  This generates an email to the admin mailing list (just me), but the email has no subject and the body only contains '--'.  Why is this?  TIA!

I never got to the bottom of this issue...  Can anyone help, please?   I'm using FluxBB v1.5.6 and User management v1.5.0.  TIA!!!

Mine works the same way in v1.5.7. This is only a minor inconvenience IMHO because the new user actually gets the proper email notification with the randomly generated password:

rail2.jpg

Last edited by signuprepli (2014-12-15 13:56:59)

Offline

#17 2014-12-15 13:55:53

chris98
Member
From: England, United Kingdom
Registered: 2013-05-31
Posts: 1,292
Website

Re: [MOD] User Management

However, I do have one small problem with it.  When I add a user, I always select 'Yes' for the 'Generate random password' option.  This generates an email to the admin mailing list (just me), but the email has no subject and the body only contains '--'.  Why is this?  TIA!

I've stopped this on my own forum, but it was a while back. If you post your code I'll take a look and see what can be changed.

Offline

#18 2014-12-15 14:08:40

signuprepli
Member
Registered: 2014-11-05
Posts: 65

Re: [MOD] User Management

Hi Chris98,

Here's the code from the two files that need to be uploaded:

lang/English/user_management.php

<?php

// Language definitions used in the user management 
$lang_user_management = array(
    
'Days must be integer message'      => 'Days must be a positive integer value.',
'Posts must be integer message'     => 'Posts must be a positive integer value.',
'Pruning complete message'          => 'Pruning complete. Users pruned: %s',
'User created message'              => 'User created',
'User management - v'               => 'User management - v',
'Plugin prune info'                 => 'This plugin allows you to prune users a certain number of days old with less than a certain number of posts.',
'Plugin warning'                    => 'Warning: This has a permanent and instant effect. Use with extreme caution (it is recomended you make a backup before using this feature).',
'Plugin add info'                   => 'It also allows you to manually add users. This is useful for closed forum e.g. if you have disabled user registration in Options.',
'User prune head'                   => 'User prune',
'Settings subhead'                  => 'Settings',
'Prune by label'                    => 'Prune by',
'Prune help'                        => 'Decides if the minimum number of days is calculated since the registered date or last login.',
'Registered date'                   => 'Registered date',
'Last login'                        => 'Last login',
'Minimum days label'                => 'Minimum days since registration/last login',
'Minimum days help'                 => 'Minimum number of days before users are pruned.',
'Maximum posts label'               => 'Maximum number of posts',
'Maximum posts help'                => 'Users with more posts than this won\'t be pruned. e.g. a value of 1 will remove users with no posts.',
'Delete admins and mods label'      => 'Delete admins and mods',
'Delete admins and mods help'       => 'When enabled, any affected admins and moderators will also be pruned.',
'User status label'                 => 'User status',
'User status help'                  => 'Decides if (un)verified users should be deleted.',
'Delete any'                        => 'Delete any',
'Delete only verified'              => 'Delete only verified',
'Delete only unverified'            => 'Delete only unverified',
'Add user head'                     => 'Add user',
'Generate random password label'    => 'Generate random password',
'Generate random password help'     => 'When enabled, a random password will be generated and emailed to the above email address.',
'Password help'                     => 'Specify a password if not generating a random password.',

);

plugins/AP_User_management.php

<?php
/***********************************************************************

  Copyright (C) 2010 Guillaume Ferrari (guillaume.ferrari@gmail.com) 
  and Quy Ton (quy@fluxbb.org) based on code Copyright (C) 2005 
  Connor Dunn (Connorhd@mypunbb.com)
  Version française originale : Maximilien Thiel (www.thiel.fr)

  This software 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.

  This software is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/

// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);
define('PLUGIN_VERSION', '1.5.0');

// Load the language file
if (file_exists(PUN_ROOT.'lang/'.$admin_language.'/user_management.php'))
	require PUN_ROOT.'lang/'.$admin_language.'/user_management.php';
else
	require PUN_ROOT.'lang/English/user_management.php';
	
// Load the register.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/register.php';

// Load the register.php/profile.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';

if (isset($_POST['prune']))
{
	// Make sure something something was entered
	$days = pun_trim($_POST['days']);
	if ($days == '' || preg_match('/[^0-9]/', $days))
		message($lang_user_management['Days must be integer message']);
		
	$posts = pun_trim($_POST['posts']);
	if ($posts == '' || preg_match('/[^0-9]/', $posts))
		message($lang_user_management['Posts must be integer message']);
		
	if ($_POST['admods_delete'] == '1') 
		$admod_delete = ' AND group_id>'.PUN_UNVERIFIED;
	else
	{
		$result = $db->query('SELECT g_id FROM '.$db->prefix.'groups WHERE g_moderator=1') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
		$group_ids = array();
		$group_ids[] = PUN_ADMIN;
		for ($i = 0;$cur_group_id = $db->result($result, $i);$i++)
			$group_ids[] = $cur_group_id;
		$admod_delete = ' AND group_id NOT IN('.implode(',', $group_ids).')';
	}

	if ($_POST['verified'] == '1')
		$verified = '';
	else if ($_POST['verified'] == '0')
		$verified = ' AND group_id>'.PUN_UNVERIFIED;
	else
		$verified = ' AND group_id='.PUN_UNVERIFIED;

	$prune = ($_POST['prune_by'] == '1') ? 'registered' : 'last_visit';
	$user_time = time() - ($days * 86400);
	
	$result = $db->query('DELETE FROM '.$db->prefix.'users WHERE id>2 AND num_posts<'.$posts.' AND '.$prune.'<'.$user_time.$admod_delete.$verified, true) or error('Unable to delete users', __FILE__, __LINE__, $db->error());
	$users_pruned = $db->affected_rows();
	message(sprintf($lang_user_management['Pruning complete message'], $users_pruned));
}
if (isset($_POST['add_user']))
{
	$username = pun_trim($_POST['username']);
	$email = strtolower(pun_trim($_POST['email']));
	$password2 = pun_trim($_POST['password2']);
		
	if ($_POST['random_pass'] == '1')
		$password = random_pass(8);
	else
		$password = pun_trim($_POST['password']);
		
	$errors = array();

	if (pun_strlen($password) < 4)
		$errors[] = $lang_prof_reg['Pass too short'];
	else if ($_POST['random_pass'] != '1' && $password != $password2)
		$errors[] = $lang_prof_reg['Pass not match'];

	check_username($username);

	// Validate e-mail
	require PUN_ROOT.'include/email.php';

	if (!is_valid_email($email))
		$errors[] = $lang_common['Invalid email'];

	// Check if it's a banned email address
	if (is_banned_email($email))
	{
		if ($pun_config['p_allow_banned_email'] == '0')
			$errors[] = $lang_prof_reg['Banned email'];
	}

	if ($pun_config['p_allow_dupe_email'] == '0')
	{
		// Check if someone else already has registered with that email address
		$result = $db->query('SELECT 1 FROM '.$db->prefix.'users WHERE email=\''.$db->escape($email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
		if ($db->num_rows($result))
			$errors[] = $lang_prof_reg['Dupe email'];
	}
	
	if (empty($errors))
	{
		$timezone = $pun_config['o_default_timezone'];
		$language = $pun_config['o_default_lang'];
		$email_setting = $pun_config['o_default_email_setting'];

		// Insert the new user into the database. We do this now to get the last inserted id for later use.
		$now = time();

		$intial_group_id = ($_POST['random_pass'] == '0') ? $pun_config['o_default_user_group'] : PUN_UNVERIFIED;
		$password_hash = pun_hash($password);

		// Add the user
		$db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, timezone, dst, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email.'\', '.$email_setting.', '.$timezone.', '.$pun_config['o_default_dst'].', \''.$language.'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error());
		$new_uid = $db->insert_id();

		// Should we alert people on the admin mailing list that a new user has registered?
		if ($pun_config['o_regs_report'] == '1')
		{
			$mail_subject = $lang_common['New user notification'];
			$mail_message = sprintf($lang_common['New user message'], $username, get_base_url().'/')."\n";
			$mail_message .= sprintf($lang_common['User profile'], get_base_url().'/profile.php?id='.$new_uid)."\n";
			$mail_message .= "\n".'--'."\n".$lang_common['Email signature'];

			pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
		}

		// Must the user verify the registration or do we log him/her in right now?
		if ($_POST['random_pass'] == '1')
		{
			// Load the "welcome" template
			$mail_tpl = pun_trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/welcome.tpl'));

			// The first row contains the subject
			$first_crlf = strpos($mail_tpl, "\n");
			$mail_subject = pun_trim(substr($mail_tpl, 8, $first_crlf-8));
			$mail_message = pun_trim(substr($mail_tpl, $first_crlf));

			$mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject);
			$mail_message = str_replace('<base_url>', get_base_url().'/', $mail_message);
			$mail_message = str_replace('<username>', $username, $mail_message);
			$mail_message = str_replace('<password>', $password, $mail_message);
			$mail_message = str_replace('<login_url>', get_base_url().'/login.php', $mail_message);
			$mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);

			pun_mail($email, $mail_subject, $mail_message);
		}
		
		// Regenerate the users info cache
		if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
			require PUN_ROOT.'include/cache.php';

		generate_users_info_cache();
			
		message($lang_user_management['User created message']);
	}
	else
		$error_reg = 1;
}
	// Display the admin navigation menu
	generate_admin_menu($plugin);

?>
	<div class="plugin blockform">
		<h2><span><?php echo $lang_user_management['User management - v'] ?><?php echo PLUGIN_VERSION ?></span></h2>
		<div class="box">
			<div class="inbox">
				<p><?php echo $lang_user_management['Plugin prune info'] ?></p>
				<p><strong><?php echo $lang_user_management['Plugin warning'] ?></strong></p>
				<p><?php echo $lang_user_management['Plugin add info'] ?></p>
			</div>
		</div>
	</div>
	<div class="blockform">
		<h2 class="block2"><span><?php echo $lang_user_management['User prune head'] ?></span></h2>
		<div class="box">
			<form id="example" method="post" action="">
				<div class="inform">
					<fieldset>
						<legend><?php echo $lang_user_management['Settings subhead'] ?></legend>
						<div class="infldset">
						<table class="aligntop" cellspacing="0">
						<!--Thanks to wiseage for this function -->
							<tr>
								<th scope="row"><?php echo $lang_user_management['Prune by label'] ?></th>
								<td>
									<input type="radio" name="prune_by" value="1" checked="checked" />&#160;<strong><?php echo $lang_user_management['Registered date'] ?></strong>&#160;&#160;&#160;<input type="radio" name="prune_by" value="0" />&#160;<strong><?php echo $lang_user_management['Last login'] ?></strong>
									<span><?php echo $lang_user_management['Prune help'] ?></span>
								</td>
							</tr>
						<!--/Thanks to wiseage for this function -->
							<tr>
								<th scope="row"><?php echo $lang_user_management['Minimum days label'] ?></th>
								<td>
									<input type="text" name="days" value="28" size="3" tabindex="1" />
									<span><?php echo $lang_user_management['Minimum days help'] ?></span>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php echo $lang_user_management['Maximum posts label'] ?></th>
								<td>
									<input type="text" name="posts" value="1"  size="7" tabindex="2" />
									<span><?php echo $lang_user_management['Maximum posts help'] ?></span>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php echo $lang_user_management['Delete admins and mods label'] ?></th>
								<td>
									<input type="radio" name="admods_delete" value="1" />&#160;<strong><?php echo $lang_admin_common['Yes'] ?></strong>&#160;&#160;&#160;<input type="radio" name="admods_delete" value="0" checked="checked" />&#160;<strong><?php echo $lang_admin_common['No'] ?></strong>
									<span><?php echo $lang_user_management['Delete admins and mods help'] ?></span>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php echo $lang_user_management['User status label'] ?></th>
								<td>
									<input type="radio" name="verified" value="1" />&#160;<strong><?php echo $lang_user_management['Delete any'] ?></strong>&#160;&#160;&#160;<input type="radio" name="verified" value="0" checked="checked" />&#160;<strong><?php echo $lang_user_management['Delete only verified'] ?></strong>&#160;&#160;&#160;<input type="radio" name="verified" value="2" />&#160;<strong><?php echo $lang_user_management['Delete only unverified'] ?></strong>
									<span><?php echo $lang_user_management['User status help'] ?></span>
								</td>
							</tr>
						</table>
						</div>
					</fieldset>
				</div>
			<p class="submitend"><input type="submit" name="prune" value="<?php echo $lang_admin_common['Prune'] ?>" tabindex="3" /></p>
			</form>
		</div>
		<h2 class="block2"><span><?php echo $lang_user_management['Add user head'] ?></span></h2>
		<?php
		if (isset($error_reg))
		{
			?>
			<div id="posterror" style="border-style:none">
				<div class="box">
					<legend><?php echo $lang_register['Registration errors'] ?></legend>
					<div class="inbox error-info infldset">
						<p><?php echo $lang_register['Registration errors info'] ?></p>
							<ul class="error-list">
							<?php
								foreach ($errors as $cur_error)
									echo "\t\t\t\t".'<li><strong>'.$cur_error.'</strong></li>'."\n";
							?>
							</ul>
					</div>
				</div>
			</div>

			<?php
		}
		?>
		<div class="box">
			<form id="example" method="post" action="">
				<div class="inform">
					<fieldset>
						<legend><?php echo $lang_user_management['Settings subhead'] ?></legend>
						<div class="infldset">
						<table class="aligntop" cellspacing="0">
							<tr>
								<th scope="row"><?php echo $lang_common['Username'] ?></th>
								<td>
									<input type="text" name="username" value="<?php if (isset($_POST['username'])) echo pun_htmlspecialchars($_POST['username']); ?>" size="25" tabindex="4" />
								</td>
							</tr>
							<tr>
								<th scope="row"><?php echo $lang_common['Email'] ?></th>
								<td>
									<input type="text" name="email" value="<?php if (isset($_POST['email'])) echo pun_htmlspecialchars($_POST['email']); ?>" size="50" tabindex="5" />
								</td>
							</tr>
							<tr>
								<th scope="row"><?php echo $lang_user_management['Generate random password label'] ?></th>
								<td>
									<input type="radio" name="random_pass" value="1" />&#160;<strong><?php echo $lang_admin_common['Yes'] ?></strong>&#160;&#160;&#160;<input type="radio" name="random_pass" value="0" checked="checked" />&#160;<strong><?php echo $lang_admin_common['No'] ?></strong>
									<span><?php echo $lang_user_management['Generate random password help'] ?></span>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php echo $lang_common['Password'] ?></th>
								<td>
									<input type="password" name="password" value="<?php if (isset($_POST['password'])) echo pun_htmlspecialchars($_POST['password']); ?>" size="25" tabindex="6" />
									<span><?php echo $lang_user_management['Password help'] ?></span>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php echo $lang_prof_reg['Confirm pass'] ?></th>
								<td>
									<input type="password" name="password2" value="<?php if (isset($_POST['password2'])) echo pun_htmlspecialchars($_POST['password2']); ?>" size="25" tabindex="6" />
									<span><?php echo $lang_register['Pass info'] ?></span>
								</td>
							</tr>
						</table>
						</div>
					</fieldset>
				</div>
				<p class="submitend"><input type="submit" name="add_user" value="<?php echo $lang_admin_common['Add'] ?>" tabindex="7" /></p>
			</form>
		</div>
	</div>

Thanks for chiming in to help others. FYI, I am happy with the way it works now; however, there is always room for improvement.

signuprepli

Offline

#19 2014-12-15 14:37:02

chris98
Member
From: England, United Kingdom
Registered: 2013-05-31
Posts: 1,292
Website

Re: [MOD] User Management

Ok, in the second file, find:

if ($pun_config['o_regs_report'] == '1')

And replace with:

if ($pun_config['o_regs_report'] == '1' && $_POST['random_pass'] == '1')

Note that the check before was only checking if you'd enabled registrations being reported in administration, and wasn't checking the status of the form. This is fixed by the check I provided. You could have disabled that, however it would also have disabled the ability to send it from this form.

Last edited by chris98 (2014-12-15 14:38:06)

Offline

#20 2014-12-15 17:10:49

signuprepli
Member
Registered: 2014-11-05
Posts: 65

Re: [MOD] User Management

Hi Chris98,

I saw no change after your proposed modification. The registering user still gets the correct email and the admin still gets a blank email:

Untitled_1.jpg

Since this is not an issue for me, the OP can continue from here...

Offline

#21 2014-12-16 08:56:08

chris98
Member
From: England, United Kingdom
Registered: 2013-05-31
Posts: 1,292
Website

Re: [MOD] User Management

You did change this one, didn't you?

// Should we alert people on the admin mailing list that a new user has registered?
		if ($pun_config['o_regs_report'] == '1')

Offline

#22 2014-12-16 09:51:20

signuprepli
Member
Registered: 2014-11-05
Posts: 65

Re: [MOD] User Management

chris98 wrote:

You did change this one, didn't you?

// Should we alert people on the admin mailing list that a new user has registered?
		if ($pun_config['o_regs_report'] == '1')

Yes. That is the only place where that line appears. I just retested with the same results as before. I also added another email address to the admin mailing list and now both addresses get blank emails. The registering user still gets the proper notification.

Last edited by signuprepli (2014-12-16 10:23:11)

Offline

#23 2014-12-16 10:30:04

signuprepli
Member
Registered: 2014-11-05
Posts: 65

Re: [MOD] User Management

Well, I played around with this a bit and got it working; however, pleased be advised I know nothing about coding so this may not be 100% correct. Essentially, what I did was send a copy of the same user registration email to the admin mailing list (I think):

plugins/AP_User_management.php

Found:

		// Should we alert people on the admin mailing list that a new user has registered?
		if ($pun_config['o_regs_report'] == '1')
		{
			$mail_subject = $lang_common['New user notification'];
			$mail_message = sprintf($lang_common['New user message'], $username, get_base_url().'/')."\n";
			$mail_message .= sprintf($lang_common['User profile'], get_base_url().'/profile.php?id='.$new_uid)."\n";
			$mail_message .= "\n".'--'."\n".$lang_common['Email signature'];

Replaced with:

		// Should we alert people on the admin mailing list that a new user has registered?
		if ($pun_config['o_regs_report'] == '1')
		{
			// Load the "welcome" template
			$mail_tpl = pun_trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/welcome.tpl'));

			// The first row contains the subject
			$first_crlf = strpos($mail_tpl, "\n");
			$mail_subject = pun_trim(substr($mail_tpl, 8, $first_crlf-8));
			$mail_message = pun_trim(substr($mail_tpl, $first_crlf));

			$mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject);
			$mail_message = str_replace('<base_url>', get_base_url().'/', $mail_message);
			$mail_message = str_replace('<username>', $username, $mail_message);
			$mail_message = str_replace('<password>', $password, $mail_message);
			$mail_message = str_replace('<login_url>', get_base_url().'/login.php', $mail_message);
			$mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);

Now admin gets an exact copy of the registration email that was sent to the new user. This works with random pass equal to 0 or 1.

Last edited by signuprepli (2014-12-16 10:32:14)

Offline

#24 2015-03-09 12:13:15

zilwil
Member
Registered: 2015-01-11
Posts: 5

Re: [MOD] User Management

Hello,
Does anyone know if it's possible to send again the message with the random generated password ? Would be great when the message goes to spam or is lost (...) by my users.
Until now I do remove the unverified user and create it again but I wonder if there's some other way.
If it's not possible yet, I'll edit the code to add this extra functionnality.
Thanks !

Offline

#25 2015-03-09 13:37:34

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,664
Website

Re: [MOD] User Management

They can use the "Forgot password" functionality, no?


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

Board footer

Powered by FluxBB