Admin notification when users delete their own account Admin notification when users delete their own account
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Admin notification when users delete their own account

Started by jmcreis, September 22, 2011, 06:27:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jmcreis

Hi guys
It is possible to have an email notification to admin when users closes his own account, similar to the notification made when a new registration happens ?
Thanks

Αndré

Maybe I just can't remember, but is it possible that a (regular) user deletes his own account at all?

jmcreis

Hi André
Yes, it is possible if the option is enable in configuration panel.
See the help: "When enabled, users can delete their user accounts. This option has been added in cpg1.5.x because of legal requirements in some countries."

Αndré

Open delete.php, find
            foreach ($users_scheduled_for_action as $key) {
           
                if ($key != USER_ID) { // a user can only delete his own account
                    cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
                }
               
                delete_user($key);
            }

and replace with
            foreach ($users_scheduled_for_action as $key) {
           
                if ($key != USER_ID) { // a user can only delete his own account
                    cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
                }
               
                delete_user($key);
               
                cpg_mail($CONFIG['gallery_admin_email'], 'A user deleted his account', 'User "'.$cpg_udb->get_user_name($key).'" deleted his account');
            }

jmcreis

Thank you very much André. I will try and send you a feedback.

jimmym

Hi Andre,

I find this option suitable for my gallery.  I've added the code in delete.php but no mail is sent to the admin email.

           
foreach ($users_scheduled_for_action as $key) {
           
                if ($key != USER_ID) { // a user can only delete his own account
                    cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
                }
               
                delete_user($key);
// 8 Dec 2011 - start
               cpg_mail($CONFIG['gallery_admin_email'], 'A user deleted his account', 'User "'.$cpg_udb->get_user_name($key).'" deleted his account');
// jimmy 8 Dec 2011 - end
            }


Could you help?