• Resolved hoyer801

    (@hoyer801)


    I manage a multisite network (30 sites) that utilizes your plugin. Several months ago, I got hit with the bug that constantly downloaded new files and saved them to the document library. I have almost 9000 images on 30 different sites that must be deleted (yep, 270,000 images to be deleted (give or take 10,000).

    Do you know of a way that I can programatically delete all files in the media library and then reset the video thumbnail for all posts? I’ve since reworked it so that it is no longer storing the thumbnail in the media library.

    I can probably figure out the other stuff by consulting the codex and forums, but if you could help me find a way to reset all video thumbnails so I don’t have to click all those posts, I’d greatly appreciate it.

    http://ww.wp.xz.cn/extend/plugins/video-thumbnails/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sutherland Boswell

    (@sutherlandboswell)

    Yikes! Very sorry that this happened to you. I believe there are some bulk deletion plugins that you could use to clear all attachments.

    As for resetting all of the video thumbnails, you should be able to make a small change so that when you use the “scan past posts” option it will clear the custom field for video thumbnails.

    In video-thumbnails.php just change this:

    function video_thumbnails_past_callback() {
    	global $wpdb; // this is how you get access to the database
    
    	$post_id = $_POST['post_id'];
    
    	// Clear video thumbnail meta before scanning
    	delete_post_meta( $post_id, '_video_thumbnail' );
    
    	echo get_the_title( $post_id ) . ' - ';
    
    	$video_thumbnail = get_video_thumbnail( $post_id );
    
    	if ( is_wp_error( $video_thumbnail ) ) {
    		echo $video_thumbnail->get_error_message();
    	} else  if ( $video_thumbnail != null ) {
    		echo '<span style="color:green">✔</span> Success!';
    	} else {
    		echo '<span style="color:red">✖</span> Couldn\'t find a video thumbnail for this post.';
    	}
    
    	die();
    }

    to this:

    function video_thumbnails_past_callback() {
    	global $wpdb; // this is how you get access to the database
    
    	$post_id = $_POST['post_id'];
    
    	// Clear video thumbnail meta
    	delete_post_meta( $post_id, '_video_thumbnail' );
    
    	echo get_the_title( $post_id ) . ' - Video Thumbnail meta deleted';
    
    	die();
    }

    Now when you run the “scan past posts” option on the settings page it will instead clear the video thumbnail information stored with the post. Once you undo the change, you can “scan past posts” normally and it will find new thumbnails.

    Let me know if you need any more help. I’m in the process of version 2.0 and one of the changes is that all media uploaded as a video thumbnail is specially tagged so that if this type of bug happened again they can all be deleted with one click.

    Thread Starter hoyer801

    (@hoyer801)

    Thanks for your help with this. Much appreciated. It really is a great plugin and provides exactly the functionality I need. I’ll try this soon and let you know if I have questions, but it looks pretty straightforward.

    Thread Starter hoyer801

    (@hoyer801)

    Just wanted to report back that this method works very well. I appreciate your help.

    In order to delete the images in a more reasonable fashion, I changed the screen options to show 999 images at a time. This resulted in a URI that was too long since the form was being sent as GET. I modified /wp-admin/upload.php so that the filter form used POST instead. It’s not ideal when you’re deleting 90000 or so images per blog, but it works.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: Video Thumbnails] reset thumbnail for all posts’ is closed to new replies.