forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 email => Topic started by: jmcreis on September 22, 2011, 06:27:27 pm

Title: Admin notification when users delete their own account
Post by: jmcreis on September 22, 2011, 06:27:27 pm
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
Title: Re: Admin notification when users delete their own account
Post by: Αndré on September 22, 2011, 06:30:48 pm
Maybe I just can't remember, but is it possible that a (regular) user deletes his own account at all?
Title: Re: Admin notification when users delete their own account
Post by: jmcreis on September 22, 2011, 07:12:38 pm
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."
Title: Re: Admin notification when users delete their own account
Post by: Αndré on September 23, 2011, 10:02:18 am
Open delete.php, find
Code: [Select]
            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
Code: [Select]
            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');
            }
Title: Re: Admin notification when users delete their own account
Post by: jmcreis on September 23, 2011, 10:59:11 am
Thank you very much André. I will try and send you a feedback.
Title: Re: Admin notification when users delete their own account
Post by: jimmym on December 08, 2011, 07:20:35 am
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.

Code: [Select]
           
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?