Skip to content

Commit

Permalink
Remove photos on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisjacquet committed May 1, 2022
1 parent 9ec77d8 commit 59d8d02
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -70,6 +70,7 @@ Changes in 9.0
- Fix stored XSS security issue: decode HTML entities from URL in PreparePHP_SELF.fnc.php, thanks to @khanhchauminh
- Accessibility: add hidden input label using .a11y-hidden class in ReportCardComments.php
- Two Lists on same page: export only first, no search in Eligibility/Student.php
- Remove photos on delete in Student.php & User.php, thank to @jo125ker

Changes in 8.9.5
----------------
Expand Down
11 changes: 11 additions & 0 deletions modules/Students/Student.php
Expand Up @@ -573,6 +573,17 @@

DBQuery( $delete_sql );

// Remove photos on delete.
$old_photo_files = glob( $StudentPicturesPath . '*/' . $_REQUEST['student_id'] . '.*jpg' );

foreach ( $old_photo_files as $old_photo_file )
{
if ( $old_photo_file !== $new_photo_file )
{
unlink( $old_photo_file );
}
}

// Hook.
do_action( 'Students/Student.php|delete_student' );

Expand Down
11 changes: 11 additions & 0 deletions modules/Users/User.php
Expand Up @@ -569,6 +569,17 @@

DBQuery( $delete_sql );

// Remove photos on delete.
$old_photo_files = glob( $UserPicturesPath . UserSyear() . '/' . $_REQUEST['staff_id'] . '.*jpg' );

foreach ( $old_photo_files as $old_photo_file )
{
if ( $old_photo_file !== $new_photo_file )
{
unlink( $old_photo_file );
}
}

// Hook.
do_action( 'Users/User.php|delete_user' );

Expand Down

0 comments on commit 59d8d02

Please sign in to comment.