Page 1 of 1

[ALPHA] User Mass Email Control

Posted: Tue Oct 19, 2004 8:02 am
by kratzer54847

Code: Select all

############################################################## 
## MOD Title: User Mass E-Mail Control 
## MOD Author: kratzer54847 < alternativ3322@web.de > (Johny Jesewski) http://www.plauderclub.de/ 
## MOD Description: User can specify in their profiles of they want to recieve mass emails or not 
## MOD Version: 0.0.2 alpha 
## 
## Installation Level: Easy 
## Installation Time: 5 Minutes 
## Files To Edit: includes/usercp_register.php, admin/admin_mass_email.php, language/lang_xxx/lang_main.php, templates/subSilver/profile_add_body.tpl, templates/subSilver/admin/user_edit_body.tpl 
## Included Files: n/a 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ 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/ 
############################################################## 
## Author Notes: 
## 
## This Mod adds an option to the user profile where the useres can specify if they want to recieve mass emails or not. 
############################################################## 
## MOD History: 
##
## 2004-10-19 - Version 0.0.2 alpha 
## - Minor db structure change used TINYINT instead of VARCHAR
## 
## 2004-10-18 - Version 0.0.1 alpha 
## - Initial Release 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ SQL ]------------------------------------------ 
# 

ALTER TABLE `phpbb_users` ADD `user_mass_email` TINYINT( 1 ) NOT NULL ; 

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

admin/admin_mass_email.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
$sql = ( $group_id != -1 ) ? "SELECT u.user_email FROM " . 
USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug 
WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " 
AND u.user_id = ug.user_id" : "SELECT user_email FROM " . 
USERS_TABLE; 

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

// 
// Get users who want a Mass Email 
// 
$sql = "SELECT u.user_email 
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug 
WHERE $group_id != '-1' 
AND ug.group_id = $group_id 
AND u.user_mass_email = '1' 
AND ug.user_pending <> " . TRUE . " 
AND u.user_id = ug.user_id"; 

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

includes/usercp_register.php 

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

$viewemail = ( isset($HTTP_POST_VARS['viewemail']) ) ? ( ($HTTP_POST_VARS['viewemail']) ? TRUE : 0 ) : 0; 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

$adminmail = ( isset($HTTP_POST_VARS['adminmail']) ) ? ( ($HTTP_POST_VARS['adminmail']) ? TRUE : 0 ) : 0; 

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

$sql = "UPDATE " . USERS_TABLE . " 

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 

user_notify_pm, 

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 

user_mass_email, 

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 

$notifyreply, 

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 

$adminmail,  

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

$sql = "INSERT INTO " . USERS_TABLE . " 

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 

user_notify_pm, 

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 

user_mass_email, 

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 

$notifypm, 

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 

 '1', 

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

$allowviewonline = $userdata['user_allow_viewonline']; 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

$adminmail = $userdata['user_mass_email']; 

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

'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '', 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

'ADMINMAIL_YES' => ( $adminmail ) ? 'checked="checked"' : '', 
'ADMINMAIL_NO' => ( !$adminmail ) ? 'checked="checked"' : '', 

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

'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'], 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

'L_ADMINMAIL' => $lang['adminmail'], 

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

language/lang_english/lang_main.php 

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

$lang['Always_notify_explain'] = 'Sends an e-mail when someone replies to a topic you have posted in. This can be changed whenever you post.'; 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

$lang['Adminmail'] = 'Administrators can email me information'; 

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

templates/subSilver/profile_add_body.tpl 

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

<tr> 
  <td class="row1"><span class="gen">{L_HIDE_USER}:</span></td> 
  <td class="row2"> 
   <input type="radio" name="hideonline" value="1" {HIDE_USER_YES} /> 
   <span class="gen">{L_YES}</span>&nbsp;&nbsp; 
   <input type="radio" name="hideonline" value="0" {HIDE_USER_NO} /> 
   <span class="gen">{L_NO}</span></td> 
</tr> 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

<tr> 
<td class="row1"><span class="gen"><b>{L_ADMINMAIL}</b></span></td> 
<td class="row2"> 
      <input type="radio" name="adminmail" value="1" {ADMINMAIL_YES} /> 
      <span class="gensmall">{L_YES}</span>&nbsp; 
      <input type="radio" name="adminmail" value="0" {ADMINMAIL_NO} /> 
      <span class="gensmall">{L_NO}</span> 
</td> 
</tr> 

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

admin/admin_users.php 

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

$user_avatar_size = ( !empty($HTTP_POST_FILES['avatar']['size']) ) ? $HTTP_POST_FILES['avatar']['size'] : 0; 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

$adminmail = ( isset($HTTP_POST_VARS['adminmail']) ) ? ( ($HTTP_POST_VARS['adminmail']) ? TRUE : 0 ) : 0; 

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

$sql = "UPDATE " . USERS_TABLE . " 

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
user_notify = $notifyreply, 

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 

user_mass_email = '$adminmail', 

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

'POPUP_PM_NO' => (!$popuppm) ? 'checked="checked"' : '', 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

'ADMINMAIL_YES' => ( $adminmail ) ? 'checked="checked"' : '', 
'ADMINMAIL_NO' => ( !$adminmail ) ? 'checked="checked"' : '', 

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

'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'], 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

'L_ADMINMAIL' => $lang['adminmail'], 

# 
#-----[ FIND ]------------------------------------------ 
# 
   $notifyreply = $this_userdata['user_notify']; 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
   $adminmail = $this_userdata['user_mass_email']; 

# 
#-----[ FIND ]------------------------------------------ 
# 
   $s_hidden_fields .= '<input type="hidden" name="notifyreply" value="' . $notifyreply . '" />';    

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

   $s_hidden_fields .= '<input type="hidden" name="adminmail" value="' . $adminmail . '" />'; 

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

templates/subSilver/user_edit_body.tpl 

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

   <tr> 
     <td class="row1"><span class="gen">{L_NOTIFY_ON_REPLY}</span></td> 
     <td class="row2"> 
      <input type="radio" name="notifyreply" value="1" {NOTIFY_REPLY_YES} /> 
      <span class="gen">{L_YES}</span>&nbsp;&nbsp; 
      <input type="radio" name="notifyreply" value="0" {NOTIFY_REPLY_NO} /> 
      <span class="gen">{L_NO}</span></td> 
   </tr> 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

<tr> 
<td class="row1"><span class="gen"><b>{L_ADMINMAIL}</b></span></td> 
<td class="row2"> 
      <input type="radio" name="adminmail" value="1" {ADMINMAIL_YES} /> 
      <span class="gensmall">{L_YES}</span>&nbsp; 
      <input type="radio" name="adminmail" value="0" {ADMINMAIL_NO} /> 
      <span class="gensmall">{L_NO}</span> 
</td> 
</tr> 

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
just want to share my code... :D

mfg Johny

Posted: Tue Oct 19, 2004 3:21 pm
by kratzer54847
Alpha 0.0.2 is out,fixed a small bug concerning Database structure.

Fix: Execute this query

Code: Select all

ALTER TABLE `phpbb_users` CHANGE `user_mass_email` `user_mass_email` TINYINT( 1 ) NOT NULL  

Posted: Wed Oct 05, 2005 8:54 am
by Alex Zuyev
Hallo,
this one mode for newsletter I am looking for. Unfortunatelly I was not able to install it because some lines in the code: it doesn't match the one of v.2.17 phpbb. If anyone managed to make it work please continue the topic. :cry:

Posted: Wed Oct 05, 2005 11:45 pm
by baerenwurm
I did some changes, check the MOD History. (It should work with 2.0.17 now btw.)

Code: Select all

##############################################################
## MOD Title: User Mass E-Mail Control
## MOD Author: kratzer54847 < alternativ3322@web.de > (Johny Jesewski) http://www.plauderclub.de/
## MOD Description: User can specify in their profiles of they want to recieve mass emails or not
## MOD Version: 0.1.2 beta (edited by baerenwurm)
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: includes/usercp_register.php, admin/admin_mass_email.php, language/lang_xxx/lang_main.php, templates/subSilver/profile_add_body.tpl, templates/subSilver/admin/user_edit_body.tpl
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ 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/
##############################################################
## Author Notes:
##
## This Mod adds an option to the user profile where the useres can specify if they want to recieve mass emails or not.
##############################################################
## MOD History:
##
## 2005-10-06 - Version 0.1.2 beta
## - Changed "Administrators can email me information" to be activated by default
## - Fixed language error
## - Added some missing modifications
## - Corrected the order of the modifications
## - Minor changes of the code structure for a better overview
## - Minor style corrections in profile_add_body.tpl and user_edit_body.tpl
##
## 2004-10-19 - Version 0.0.2 alpha
## - Minor db structure change used TINYINT instead of VARCHAR
##
## 2004-10-18 - Version 0.0.1 alpha
## - Initial Release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#

ALTER TABLE `phpbb_users` ADD `user_mass_email` TINYINT( 1 ) NOT NULL ;
UPDATE `phpbb_users` SET `user_mass_email` = 1 ;

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

admin/admin_mass_email.php

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

$sql = ( $group_id != -1 ) ? "SELECT u.user_email FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE;

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

//
// Get users who want a Mass Email
//
$sql = "SELECT u.user_email
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug
WHERE $group_id != '-1'
AND ug.group_id = $group_id
AND u.user_mass_email = '1'
AND ug.user_pending <> " . TRUE . "
AND u.user_id = ug.user_id";

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

includes/usercp_register.php

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

$allowviewonline = ( isset($HTTP_POST_VARS['hideonline']) ) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : TRUE ) : TRUE;

#
#-----[ AFTER, ADD ]------------------------------------------
#

$adminmail = ( isset($HTTP_POST_VARS['adminmail']) ) ? ( ($HTTP_POST_VARS['adminmail']) ? TRUE : 0 ) : TRUE;

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

$sql = "UPDATE " . USERS_TABLE . "

#
#-----[ IN-LINE FIND ]------------------------------------------
#

user_allow_viewonline = $allowviewonline,

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 user_mass_email = $adminmail,

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

$sql = "INSERT INTO " . USERS_TABLE . "

#
#-----[ IN-LINE FIND ]------------------------------------------
#

user_allow_viewonline,

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 user_mass_email,

#
#-----[ IN-LINE FIND ]------------------------------------------
#

$allowviewonline,

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 '1',

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

$allowviewonline = $userdata['user_allow_viewonline'];

#
#-----[ AFTER, ADD ]------------------------------------------
#

$adminmail = $userdata['user_mass_email'];

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

display_avatar_gallery(

#
#-----[ IN-LINE FIND ]------------------------------------------
#

$allowviewonline,

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 $adminmail,

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

'HIDE_USER_NO' => ( $allowviewonline ) ? 'checked="checked"' : '',

#
#-----[ AFTER, ADD ]------------------------------------------
#

'ADMINMAIL_YES' => ( $adminmail ) ? 'checked="checked"' : '',
'ADMINMAIL_NO' => ( !$adminmail ) ? 'checked="checked"' : '',

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

'L_HIDE_USER' => $lang['Hide_user'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

'L_ADMINMAIL' => $lang['Adminmail'],

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

language/lang_english/lang_main.php

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

$lang['Always_notify_explain'] = 'Sends an e-mail when someone replies to a topic you have posted in. This can be changed whenever you post.';

#
#-----[ AFTER, ADD ]------------------------------------------
#

$lang['Adminmail'] = 'Administrators can email me information';

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

templates/subSilver/profile_add_body.tpl

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

	<tr>
	  <td class="row1"><span class="gen">{L_HIDE_USER}:</span></td>
	  <td class="row2">
		<input type="radio" name="hideonline" value="1" {HIDE_USER_YES} />
		<span class="gen">{L_YES}</span>&nbsp;&nbsp;
		<input type="radio" name="hideonline" value="0" {HIDE_USER_NO} />
		<span class="gen">{L_NO}</span></td>
	</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#

	<tr>
	  <td class="row1"><span class="gen">{L_ADMINMAIL}</span></td>
	  <td class="row2">
		<input type="radio" name="adminmail" value="1" {ADMINMAIL_YES} />
		<span class="gen">{L_YES}</span>&nbsp;&nbsp;
		<input type="radio" name="adminmail" value="0" {ADMINMAIL_NO} />
		<span class="gen">{L_NO}</span></td>
	</tr>

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

admin/admin_users.php

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

$allowviewonline = ( isset( $HTTP_POST_VARS['hideonline']) ) ? ( ( $HTTP_POST_VARS['hideonline'] ) ? 0 : TRUE ) : TRUE;

#
#-----[ AFTER, ADD ]------------------------------------------
#

$adminmail = ( isset($HTTP_POST_VARS['adminmail']) ) ? ( ($HTTP_POST_VARS['adminmail']) ? TRUE : 0 ) : TRUE;

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

$sql = "UPDATE " . USERS_TABLE . "

#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_allow_viewonline = $allowviewonline,

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 user_mass_email = '$adminmail',

#
#-----[ FIND ]------------------------------------------
#
$allowviewonline = $this_userdata['user_allow_viewonline'];

#
#-----[ AFTER, ADD ]------------------------------------------
#
$adminmail = $this_userdata['user_mass_email'];


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

'HIDE_USER_NO' => ($allowviewonline) ? 'checked="checked"' : '',

#
#-----[ AFTER, ADD ]------------------------------------------
#

'ADMINMAIL_YES' => ( $adminmail ) ? 'checked="checked"' : '',
'ADMINMAIL_NO' => ( !$adminmail ) ? 'checked="checked"' : '',

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

'L_HIDE_USER' => $lang['Hide_user'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

'L_ADMINMAIL' => $lang['Adminmail'],


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

$s_hidden_fields .= '<input type="hidden" name="hideonline" value="' . !$allowviewonline . '" />'; 

#
#-----[ AFTER, ADD ]------------------------------------------
#

$s_hidden_fields .= '<input type="hidden" name="adminmail" value="' . $adminmail . '" />';

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

templates/subSilver/admin/user_edit_body.tpl

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

	<tr> 
	  <td class="row1"><span class="gen">{L_HIDE_USER}</span></td>
	  <td class="row2"> 
		<input type="radio" name="hideonline" value="1" {HIDE_USER_YES} />
		<span class="gen">{L_YES}</span>&nbsp;&nbsp; 
		<input type="radio" name="hideonline" value="0" {HIDE_USER_NO} />
		<span class="gen">{L_NO}</span></td>
	</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#

	<tr>
	  <td class="row1"><span class="gen">{L_ADMINMAIL}</span></td>
	  <td class="row2">
		<input type="radio" name="adminmail" value="1" {ADMINMAIL_YES} />
		<span class="gen">{L_YES}</span>&nbsp;&nbsp;
		<input type="radio" name="adminmail" value="0" {ADMINMAIL_NO} />
		<span class="gen>{L_NO}</span></td>
	</tr>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

Posted: Mon Jul 10, 2006 11:09 am
by CCACCA
Hello.
I have Installed this of mod on phpbb 2.0.21.
At attempt to carry out dispatch, there is a message " Excuse, but such user does not exist " I understand a problem in inquiry:

Code: Select all

$sql = "SELECT u.user_email 
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug 
WHERE $group_id != '-1' 
AND ug.group_id = $group_id 
AND u.user_mass_email = '1' 
AND ug.user_pending <> " . TRUE . " 
AND u.user_id = ug.user_id"; 
What it is possible to make?

Posted: Fri Jul 14, 2006 9:21 am
by carlton
Well, phpbb.it's Xion and me did definitive fixes, I think.

What causes problems is this query in admin/admin_mass_email.php

Code: Select all

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

$sql = ( $group_id != -1 ) ? "SELECT u.user_email FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE;

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

//
// Get users who want a Mass Email
//
$sql = "SELECT u.user_email
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug
WHERE $group_id != '-1'
AND ug.group_id = $group_id
AND u.user_mass_email = '1'
AND ug.user_pending <> " . TRUE . "
AND u.user_id = ug.user_id";
A well working query is

Code: Select all

$sql = ( $group_id != -1 ) ? "SELECT u.user_email
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id
AND u.user_mass_email = '1'
AND ug.user_pending <> " . TRUE . "
AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE . " WHERE user_mass_email = '1'";
So a RC of this MOD could be as below

Code: Select all

##############################################################
## MOD Title: User Mass E-Mail Control
## MOD Author: kratzer54847 < alternativ3322@web.de > (Johny Jesewski) http://www.plauderclub.de/
## MOD Description: User can specify in their profiles of they want to recieve mass emails or not
## MOD Version: 0.3.0 (edited by baerenwurm, Xion, carlton)
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit:
##
## includes/usercp_register.php,
## admin/admin_mass_email.php
## admin/admin_users.php
## language/lang_xxx/lang_main.php
## templates/subSilver/profile_add_body.tpl,
## templates/subSilver/admin/user_edit_body.tpl
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ 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/
##############################################################
## Author Notes:
##
## This Mod adds an option to the user profile where the useres can specify if they want to recieve mass emails or not.
##############################################################
## MOD History:
##
## 2006-07-13 - v.0.3.0
##
## 2005-10-06 - Version 0.1.2 beta
## Fixed sql query and ACP template error
## - Changed "Administrators can email me information" to be activated by default
## - Fixed language error
## - Added some missing modifications
## - Corrected the order of the modifications
## - Minor changes of the code structure for a better overview
## - Minor style corrections in profile_add_body.tpl and user_edit_body.tpl
##
## 2004-10-19 - Version 0.0.2 alpha
## - Minor db structure change used TINYINT instead of VARCHAR
##
## 2004-10-18 - Version 0.0.1 alpha
## - Initial Release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#

ALTER TABLE `phpbb_users` ADD `user_mass_email` TINYINT( 1 ) NOT NULL ;
UPDATE `phpbb_users` SET `user_mass_email` = 1 ;

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

admin/admin_mass_email.php

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

$sql = ( $group_id != -1 ) ? "SELECT u.user_email FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE;

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

//
// Get users who want a Mass Email
//
$sql = ( $group_id != -1 ) ? "SELECT u.user_email
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id
AND u.user_mass_email = '1'
AND ug.user_pending <> " . TRUE . "
AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE . " WHERE user_mass_email = '1'";
   

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

includes/usercp_register.php

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

$allowviewonline = ( isset($HTTP_POST_VARS['hideonline']) ) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : TRUE ) : TRUE;

#
#-----[ AFTER, ADD ]------------------------------------------
#

$adminmail = ( isset($HTTP_POST_VARS['adminmail']) ) ? ( ($HTTP_POST_VARS['adminmail']) ? TRUE : 0 ) : TRUE;

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

$sql = "UPDATE " . USERS_TABLE . "

#
#-----[ IN-LINE FIND ]------------------------------------------
#

user_allow_viewonline = $allowviewonline,

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 user_mass_email = $adminmail,

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

$sql = "INSERT INTO " . USERS_TABLE . "

#
#-----[ IN-LINE FIND ]------------------------------------------
#

user_allow_viewonline,

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 user_mass_email,

#
#-----[ IN-LINE FIND ]------------------------------------------
#

$allowviewonline,

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 '1',

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

$allowviewonline = $userdata['user_allow_viewonline'];

#
#-----[ AFTER, ADD ]------------------------------------------
#

$adminmail = $userdata['user_mass_email'];

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

display_avatar_gallery(

#
#-----[ IN-LINE FIND ]------------------------------------------
#

$allowviewonline,

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 $adminmail,

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

'HIDE_USER_NO' => ( $allowviewonline ) ? 'checked="checked"' : '',

#
#-----[ AFTER, ADD ]------------------------------------------
#

'ADMINMAIL_YES' => ( $adminmail ) ? 'checked="checked"' : '',
'ADMINMAIL_NO' => ( !$adminmail ) ? 'checked="checked"' : '',

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

'L_HIDE_USER' => $lang['Hide_user'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

'L_ADMINMAIL' => $lang['Adminmail'],

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

language/lang_english/lang_main.php

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

$lang['Always_notify_explain'] = 'Sends an e-mail when someone replies to a topic you have posted in. This can be changed whenever you post.';

#
#-----[ AFTER, ADD ]------------------------------------------
#

$lang['Adminmail'] = 'Administrators can email me information';

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

templates/subSilver/profile_add_body.tpl

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

   <tr>
     <td class="row1"><span class="gen">{L_HIDE_USER}:</span></td>
     <td class="row2">
      <input type="radio" name="hideonline" value="1" {HIDE_USER_YES} />
      <span class="gen">{L_YES}</span>&nbsp;&nbsp;
      <input type="radio" name="hideonline" value="0" {HIDE_USER_NO} />
      <span class="gen">{L_NO}</span></td>
   </tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#

   <tr>
     <td class="row1"><span class="gen">{L_ADMINMAIL}</span></td>
     <td class="row2">
      <input type="radio" name="adminmail" value="1" {ADMINMAIL_YES} />
      <span class="gen">{L_YES}</span>&nbsp;&nbsp;
      <input type="radio" name="adminmail" value="0" {ADMINMAIL_NO} />
      <span class="gen">{L_NO}</span></td>
   </tr>

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

admin/admin_users.php

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

$allowviewonline = ( isset( $HTTP_POST_VARS['hideonline']) ) ? ( ( $HTTP_POST_VARS['hideonline'] ) ? 0 : TRUE ) : TRUE;

#
#-----[ AFTER, ADD ]------------------------------------------
#

$adminmail = ( isset($HTTP_POST_VARS['adminmail']) ) ? ( ($HTTP_POST_VARS['adminmail']) ? TRUE : 0 ) : TRUE;

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

$sql = "UPDATE " . USERS_TABLE . "

#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_allow_viewonline = $allowviewonline,

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 user_mass_email = '$adminmail',

#
#-----[ FIND ]------------------------------------------
#
$allowviewonline = $this_userdata['user_allow_viewonline'];

#
#-----[ AFTER, ADD ]------------------------------------------
#
$adminmail = $this_userdata['user_mass_email'];


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

'HIDE_USER_NO' => ($allowviewonline) ? 'checked="checked"' : '',

#
#-----[ AFTER, ADD ]------------------------------------------
#

'ADMINMAIL_YES' => ( $adminmail ) ? 'checked="checked"' : '',
'ADMINMAIL_NO' => ( !$adminmail ) ? 'checked="checked"' : '',

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

'L_HIDE_USER' => $lang['Hide_user'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

'L_ADMINMAIL' => $lang['Adminmail'],


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

$s_hidden_fields .= '<input type="hidden" name="hideonline" value="' . !$allowviewonline . '" />';

#
#-----[ AFTER, ADD ]------------------------------------------
#

$s_hidden_fields .= '<input type="hidden" name="adminmail" value="' . $adminmail . '" />';

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

templates/subSilver/admin/user_edit_body.tpl

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

   <tr>
     <td class="row1"><span class="gen">{L_HIDE_USER}</span></td>
     <td class="row2">
      <input type="radio" name="hideonline" value="1" {HIDE_USER_YES} />
      <span class="gen">{L_YES}</span>&nbsp;&nbsp;
      <input type="radio" name="hideonline" value="0" {HIDE_USER_NO} />
      <span class="gen">{L_NO}</span></td>
   </tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#

   <tr>
     <td class="row1"><span class="gen">{L_ADMINMAIL}</span></td>
     <td class="row2">
      <input type="radio" name="adminmail" value="1" {ADMINMAIL_YES} />
      <span class="gen">{L_YES}</span>&nbsp;&nbsp;
      <input type="radio" name="adminmail" value="0" {ADMINMAIL_NO} />
      <span class="gen">{L_NO}</span></td>
   </tr>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

Posted: Fri Jul 14, 2006 9:40 am
by igorw
This MOD is 1 and a half years old... Does it still work?

Posted: Fri Jul 14, 2006 11:10 am
by carlton
MOD has been reviewed and tested on a 2.0.21 board, proving its soundness.
Please, if you are interested try it and let us know.
Thanks :wink:

Posted: Fri Jul 14, 2006 4:08 pm
by _Xion_

Posted: Thu Sep 21, 2006 8:52 pm
by ashras99
When i try to install this mod through easymod. Then getting this Critical error

Code: Select all

IN-LINE FIND FAILED: In file [includes/usercp_register.php] could not find:

user_allow_viewonline = $allowviewonline,

MOD script line #116 :: FAQ :: Report

Posted: Thu Sep 21, 2006 8:54 pm
by ashras99
I think this is related to something user view online or hidden status. If this then i delete from the registration form because dont require on my site.

so, how i proceed.

Posted: Wed Jan 10, 2007 2:28 am
by kenerly
I have a user who has no checked in his user cp but is still getting the emails.

Any idea where to start?