mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Fix: Don't delete photo that belongs to the Social Activity post or Groups post
This commit is contained in:
@@ -1350,7 +1350,21 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
unlink( $file );
|
||||
// Don't delete photo that belongs to the Social Activity post or Groups post
|
||||
if ( strstr( $str, 'stream_photo' ) ) {
|
||||
global $wpdb;
|
||||
$is_post_image = $wpdb->get_var( "
|
||||
SELECT COUNT(*) FROM {$wpdb->postmeta}
|
||||
WHERE `meta_key`='_photo' AND `meta_value`='{$str}';" );
|
||||
if ( $is_post_image ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$can_unlink = apply_filters( 'um_can_remove_uploaded_file', true, $user_id, $str );
|
||||
if ( $can_unlink ) {
|
||||
unlink( $file );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user