Advanced search  

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

Pages: [1]   Go Down

Author Topic: Admin notification when users delete their own account  (Read 8457 times)

0 Members and 1 Guest are viewing this topic.

jmcreis

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
Admin notification when users delete their own account
« 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Admin notification when users delete their own account
« Reply #1 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?
Logged

jmcreis

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
Re: Admin notification when users delete their own account
« Reply #2 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."
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Admin notification when users delete their own account
« Reply #3 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');
            }
Logged

jmcreis

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
Re: Admin notification when users delete their own account
« Reply #4 on: September 23, 2011, 10:59:11 am »

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

jimmym

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Admin notification when users delete their own account
« Reply #5 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?
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.