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); 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') && !strstr($str, 'stream_photo') && !preg_grep('/' . $str . '/', $array)) { unlink($file); } } } }
function delete($send_mail = true) { global $ultimatemember; do_action('um_delete_user_hook'); do_action('um_delete_user', um_user('ID')); // send email notifications if ($send_mail) { $ultimatemember->mail->send(um_user('user_email'), 'deletion_email'); $ultimatemember->mail->send(um_admin_email(), 'notification_deletion', array('admin' => true)); } // remove uploads $ultimatemember->files->remove_dir(um_user_uploads_dir()); // remove user if (is_multisite()) { if (!function_exists('wpmu_delete_user')) { require_once ABSPATH . 'wp-admin/includes/ms.php'; } wpmu_delete_user($this->id); } else { if (!function_exists('wp_delete_user')) { require_once ABSPATH . 'wp-admin/includes/user.php'; } wp_delete_user($this->id); } }
function um_profile_field_filter_hook__image($value, $data) { $uri = um_user_uploads_uri() . $value; $title = isset($data['title']) ? $data['title'] : __('Untitled photo'); if (file_exists(um_user_uploads_dir() . $value)) { $value = '<div class="um-photo"><a href="#" class="um-photo-modal" data-src="' . $uri . '"><img src="' . $uri . '" alt="' . $title . '" title="' . $title . '" class="" /></a></div>'; } else { $value = ''; } return $value; }
function um_profile_field_filter_hook__image($value, $data) { $uri = um_user_uploads_uri() . $value; $title = isset($data['title']) ? $data['title'] : __('Untitled photo'); // if value is an image tag if (preg_match('/\\<img.*src=\\"([^"]+).*/', $value, $matches)) { $uri = $matches[1]; $value = '<div class="um-photo"><a href="#" class="um-photo-modal" data-src="' . $uri . '"><img src="' . $uri . '" alt="' . $title . '" title="' . $title . '" class="" /></a></div>'; } else { if (file_exists(um_user_uploads_dir() . $value)) { $value = '<div class="um-photo"><a href="#" class="um-photo-modal" data-src="' . $uri . '"><img src="' . $uri . '" alt="' . $title . '" title="' . $title . '" class="" /></a></div>'; } else { $value = ''; } } return $value; }