File Gallery
[resolved] "attach all checked items to current post" fix [RC3] (2 posts)

  1. alx359
    Posted 4 years ago #

    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;
    add_action('wp_ajax_file_gallery_copy_attachments_to_post', 'file_gallery_copy_attachments_to_post');
  2. Aesqe
    Plugin Author

    Posted 4 years ago #

    ok, added to RC4, will update soon, thanks alx359 :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • File Gallery
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic