NightriderXP wrote: Excellent. The 1.1.2 version works much better. I have more than one admin in my community, so it would be nice to be able to set more than one admin, perhaps in the ACP instead of hardcoding it. But I am happy with what this offers. Perhaps in future versions, you can add the additional ACP feature with multiple permissions too...
![]()
Code: Select all
$checkforid = "0"; // sets the ID of the authorised admin/user, anything other than this ID will trigger the mod
$adminemailid = "2"; // sets the user ID of the person to email if mod is triggered
$adminemailid2 = "3"; // sets the user ID of the person to email if mod is triggered
if( $userdata['user_id'] != $checkforid ) //User ID of Admin, checks if the user ID is NOT admin user id, if true it runs the statement.
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
$sql = 'SELECT user_email, user_timezone, user_dateformat FROM ' . USERS_TABLE .
' WHERE user_id =' . $adminemailid .
' OR user_id =' . $adminemailid2;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->email_address(trim($row['user_email']));
$emailer->use_template('admin_acp_login');
$emailer->set_subject($lang['ACP_Login']);
$emailer->assign_vars(array(
'USERNAME' => $userdata['username'],
'USERID' => $userdata['user_id'],
'USERIP' => decode_ip($user_ip),
'SITENAME' => $board_config['sitename'],
'TIME' => sprintf($lang['Current_time'], create_date($row['user_dateformat'], time(), $row['user_timezone'])))
);
$emailer->send();
$emailer->reset();
}
$db->sql_freeresult($result);
}
Code: Select all
$adminid = array( "2","3" );
$emailto = array( "2","3" );
$validid = 0;
for($i = 0; $i < count($adminid) && !$validid; $i++)
{
$validid = $userdata['user_id'] == $adminid[$i];
}
if( !$validid ) //User ID of Admin, checks if the user ID is NOT admin user id, if true it runs the statement.
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);
$sql = 'SELECT user_email, user_timezone, user_dateformat FROM ' . USERS_TABLE;
for($i = 0; $i < count($emailto); $i++)
{
if ( !$i )
{
$sql = $sql . ' WHERE user_id =' . $emailto[$i];
}
{
$sql = $sql . ' OR user_id =' . $emailto[$i];
}
}
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->email_address(trim($row['user_email']));
$emailer->use_template('admin_acp_login');
$emailer->set_subject($lang['ACP_Login']);
$emailer->assign_vars(array(
'USERNAME' => $userdata['username'],
'USERID' => $userdata['user_id'],
'USERIP' => decode_ip($user_ip),
'SITENAME' => $board_config['sitename'],
'TIME' => sprintf($lang['Current_time'], create_date($row['user_dateformat'], time(), $row['user_timezone'])))
);
$emailer->send();
$emailer->reset();
}
$db->sql_freeresult($result);
}