gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Uploaded to this Post - Unattached

Open StaggerLeee opened this issue 9 years ago • 4 comments

Select dropdown is missing from media management modal.

  • Images
  • Uploaded to this Post
  • Unattached

Are those options gone for some reason ? Or you just did not have time right now for it.

StaggerLeee avatar Aug 04 '17 13:08 StaggerLeee

They haven't been added but I would also argue about their usefulness for most users. There are a lot of problems with the current media flow I would like to not see repeated in Gutenberg.

karmatosed avatar Aug 04 '17 15:08 karmatosed

OK, thanks. I dont have some opinion about it. Dont know all reasons in background.

Please dont forget all installations where User is limited to see only image attached to this Post. (As example classifieds WP website). Before I used this snippet, could not find any with PHP code only. But better any solution than none. Now you have oportunity to think about very different, versatile cases WP as CMS is used.

/**
 * Restict to display images in WP Media to only that attached to the current post
 */
add_action( 'admin_footer-post-new.php', 'firmasite_mediapanel_lock_uploaded' );
add_action( 'admin_footer-post.php', 'firmasite_mediapanel_lock_uploaded' );
function firmasite_mediapanel_lock_uploaded() {
	$user = get_current_user();
	// Exclusion is administrator or editor
	if ( user_can( $user, 'manage_options' ) || user_can( $user, 'edit_others_posts' ) ) {
		return;
	}
	?>
	<script type="text/javascript">
	jQuery(document).on("DOMNodeInserted", function(){
		// Lock uploads to "Uploaded to this post"
		jQuery('select.attachment-filters [value="uploaded"]').attr( 'selected', true ).parent().trigger('change');
	});
	</script>
<?php }

StaggerLeee avatar Aug 04 '17 16:08 StaggerLeee

Noting that as of #1967 (specifically 7bfe5a95cf38d73ac22975f830d6aa99cfd5547f) we at least associate uploads made during a post session with as "Uploaded To" the post.

aduth avatar Aug 04 '17 16:08 aduth

These are not only useful, but a deal-breaker. Going back to Classic editor and will move to any other editor available before ever trying Gutenberg again. So many bugs.

devisan avatar May 17 '20 19:05 devisan