Update 1.0.58

This commit is contained in:
ultimatemember
2015-02-17 00:51:40 +02:00
parent 60943d9695
commit 251f7b0ef7
14 changed files with 79 additions and 35 deletions
+11 -6
View File
@@ -6,16 +6,21 @@
add_action('um_after_user_upload','um_remove_unused_uploads', 10);
function um_remove_unused_uploads( $user_id ) {
global $ultimatemember;
um_fetch_user( $user_id );
$array = $ultimatemember->user->profile;
$files = glob( um_user_uploads_dir() . '*', GLOB_BRACE);
foreach($files as $file) {
$str = basename($file);
if ( !strstr( $str, 'profile_photo') && !strstr( $str, 'cover_photo') && !preg_grep('/' . $str . '/', $array ) )
unlink( $file );
if ( file_exists( um_user_uploads_dir() ) && $files && isset( $array ) && is_array( $array ) ) {
foreach($files as $file) {
$str = basename($file);
if ( !strstr( $str, 'profile_photo') && !strstr( $str, 'cover_photo') && !preg_grep('/' . $str . '/', $array ) )
unlink( $file );
}
}
}