• Resolved alx359

    (@alx359)


    Edit post mode->Upload/Insert->Media Library. There’s a bug when no items are checked and one clicks the “attach all checked items to current post”.

    The fix has 2 parts:

    file-gallery\includes\attachments.php ~li 340

    /* [alx359] $current_attachments gets empty array for no attachments,
     which is not catched by !== and by consequence crashes the condition
    if( false !== $current_attachments ) // if post already has attachments	*/
    if( !empty($current_attachments) ) // if post already has attachments
    {
    	foreach( $possible_new_attachments as $pna ) // for each checked item...

    ~li 390 add new code:

    // return output prepended by a list of checked attachments
    	// using # (hash) as the separator
    
    	//[alx359] added. if $attached_ids is not an array implode blows up
    	if (empty($attached_ids)) $attached_ids = array(); 
    
    	echo implode(',', $attached_ids) . '#' . $output;
    
    	exit();
    }
    add_action('wp_ajax_file_gallery_copy_attachments_to_post', 'file_gallery_copy_attachments_to_post');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘"attach all checked items to current post" fix [RC3]’ is closed to new replies.