Function Reference: geodir_remove_temp_images

Summary

Remove current user’s temporary images.

Global Values

$current_user
(object) (required) Current user object.

Default: None

Package

GeoDirectory

Change Log

Since: 1.0.0

Source File

geodir_remove_temp_images() is located in geodirectory-functions/post_functions.php [Line: 1185]

Source Code

function geodir_remove_temp_images()
{

    global $current_user;

    $uploads = wp_upload_dir();
    $uploads_dir = $uploads['path'];

    /*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){

			$dirPath = $uploads_dir.'/temp_'.$current_user->data->ID;
			if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
				$dirPath .= '/';
			}
			$files = glob($dirPath . '*', GLOB_MARK);
			foreach ($files as $file) {
				if (is_dir($file)) {
					self::deleteDir($file);
				} else {
					unlink($file);
				}
			}
			rmdir($dirPath);
	}	*/

    $dirname = $uploads_dir . '/temp_' . $current_user->ID;
    geodir_delete_directory($dirname);
}