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

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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?