Hi All -
No idea how efficient this code .. but here is the process for sending automatic mails when admin uploads an image. Please note this upload is not from ACP. Admin needs to upload the images from the website like other users..
You may take the backup of the file before doing the changes ..
Step 1 : Open
member.php and insert below these lines ..
if ($config['upload_notify'] == 1 && !$direct_upload) {
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$config['upload_emails'] = str_replace(" ", "", $config['upload_emails']);
$emails = explode(",", $config['upload_emails']);
$validation_url = $script_url."/admin/index.php?goto=".urlencode("validateimages.php?action=validateimages");
$site_email->set_to($config['site_email']);
$site_email->set_subject($lang['new_upload_emailsubject']);
$site_email->register_vars(array(
"image_name" => stripslashes($image_name),
"file_name" => $new_name,
"cat_name" => $cat_cache[$cat_id]['cat_name'],
"validation_url" => $validation_url,
"site_name" => $config['site_name']
));
$site_email->set_body("upload_notify", $config['language_dir_default']);
$site_email->set_bcc($emails);
$site_email->send_email();
}
New code : // -------------------------------------------------------------------------------------
// SEND EMAIL TO ALL THE USERS
// -------------------------------------------------------------------------------------
if ($user_info['user_level'] == ADMIN ) {
$sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email")."
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_id")." <> ".GUEST." AND ".get_user_table_field("", "user_allowemails")." = 1
ORDER BY ".get_user_table_field("", "user_level")." DESC";
$result = $site_db->query($sql);
@set_time_limit(1200);
include(ROOT_PATH.'includes/email.php');
while ($row = $site_db->fetch_array($result)) {
$user_email = $row[$user_table_fields['user_email']];
$site_email = new Email();
$validation_url = $script_url."/details.php?image_id=".$image_id;
$site_email->set_to($user_email);
$site_email->register_vars(array(
"image_name" => stripslashes($image_name),
"file_name" => $new_name,
"cat_name" => $cat_cache[$cat_id]['cat_name'],
"validation_url" => $validation_url,
"site_name" => $config['site_name']
));
$site_email->set_subject($lang['new_upload_emailsubject']);
$site_email->set_body("upload_not", $config['language_dir_default']);
$site_email->send_email();
}
}
//------------------------------- CODE ENDS HERE ---------------------------------
Step 2: Create a new file called
upload_not.html and place it in
\lang\english\email folder and put what message you want to send to all the users. ( I just copied the details from upload_notify.html file with little modification

)
Thants it.. now Enjoy !!!