• Resolved regmanabq

    (@regmanabq)


    Just installed the plug in and have been testing around with it on a brand new WP 4 install. When uploading images via the insert media button on a post I would input the info on the right side, caption, description, alt text..ect… but it didn’t seem to be saving correctly.

    editing the image on the page showed the caption and alt text ok, but looking at it in the library and all data was blank.. caption, description, alt text.. all blank. I tried it with many different images, but every time I had MLA activated, nothing would save. When it was disabled everything saved fine.

    So, disabled all plug ins, switched to twenty fourteen theme, everything I could think of and the problem persisted.. activate MLA and the data would not save.

    I even went back and installed it fresh on my old WP 3.9.2 install.. same thing.. nothing saves. on the page you can see the caption and alt text, but in the library it is all blank when uploading while MLA is active. Deactivate it and all saves fine.

    Bug with the new update? or expected behaviour?? Thought I’d post to let you know and see if you had any ideas.

    the plug in looks great and would solve a few of the problems i’ll have with this new site.. just need it to save the info from the first upload screen.

    https://www.ads-software.com/plugins/media-library-assistant/

Viewing 8 replies - 16 through 23 (of 23 total)
  • Thread Starter regmanabq

    (@regmanabq)

    Just thought I’d kick over and give an update! I have successfully managed to get MLA to display a list of all the images on a page in the order they appear!! LOL.. and in the end it really wasn’t that hard.. now to figure out the template and such to get it to display the way I want.

    Here’s the code for reference, anyone feel free to use or modify it as you wish.. maybe it could be a new fun option in the plug in too?

    /*  ----------------------------------------------------------------------------
        Functions for getting all the images on a page and displaying an image credit list
    */
    //gets the ids of all images included in the post/page
    
    function rr_get_images_on_page_ids ( $content ) {
    
     	global $post;
    
     	$image_list = array();
    
     //if there is a featured image, let's grab it and add it to the list first
     	$featured_image_id = get_post_thumbnail_id();
    
     	if ( $featured_image_id ) {
    
     		$image_list[] = $featured_image_id ;
    
     	}//end if featured image
    
    /* Check the content for <code>id=&quot;wp-image-%d&quot;</code>.  **second line modified to suit custom theme code**
     and put matches into array (&image_ids sorted by order they appear*/
    
    		//preg_match( '/id=[\'"]a-([\d]*)[\'"]/i', $content, $image_ids, PREG_PATTERN_ORDER );//for regular WP
    	preg_match_all( '/id=[\'"]attachment_([\d]*)[\'"]/i', $content, $image_ids, PREG_PATTERN_ORDER );//for newspaper theme
    
    //Merge the two arrays and turn it into a comma delimited list
    	$image_list = array_merge ( $image_list , $image_ids[1] ) ;
    
    		$commalist.= implode( ',' , $image_list );
    
     	return $commalist;	
    
     	}//end rr_get_images_on_page_ids
    
    function rr_mla_gallery_query_arguments ( $all_query_parameters ) {
    
     	global $post;
    //if we have a post_parent set to creditlist set up query to include images on page and sort by order they appear
     	if ($all_query_parameters[ 'post_parent' ] = "creditlist" ) {
     		$content = $post->post_content;
    
    		$all_query_parameters[ 'include' ] = rr_get_images_on_page_ids ( $content );
    		$all_query_parameters[ 'orderby' ] = "post__in";
    
    	}//end if credit list
    
    	return $all_query_parameters;
    }// END mla_gallery_query_arguments
    
    add_filter( 'mla_gallery_query_arguments' , 'rr_mla_gallery_query_arguments', 10, 2 );

    would also be interested in anyone’s feedback on improving the code… it is v .01 and all!

    Thread Starter regmanabq

    (@regmanabq)

    ok, and for reference for anyone finding this and wanting to do the same.. adding custom boxes to the edit media and upload media was fairly easy as well. Now I seem to get this field anywhere I’d like. woot!!!

    /**
     * Add image credit fields metabox to the media details
     */
    
    function rr_add_attachment_credit_author_field( $form_fields, $post ) {
    
        $field_value = get_post_meta( $post->ID, 'rr_credit_author', true );
    
        $form_fields[ 'rr_credit_author' ] = array(
            'value' => $field_value ? $field_value : '',
            'label' => __( 'Credit Author' ),
            'helps' => __( 'Who is the author we should credit?' )
        );
        return $form_fields;
    }
    add_filter( 'attachment_fields_to_edit', 'rr_add_attachment_credit_author_field', 10, 2 );
    
    function rr_save_attachment_credit_author( $attachment_id ) {
        if ( isset( $_REQUEST['attachments'][$attachment_id]['rr_credit_author'] ) ) {
            $creditauthor = $_REQUEST['attachments'][$attachment_id]['rr_credit_author'];
            update_post_meta( $attachment_id, 'rr_credit_author', $creditauthor );
        }
    }
    add_action( 'edit_attachment', 'rr_save_attachment_credit_author' );
    
    /*  ----------------------------------------------------------------------------
        Functions for adding custom fields to attachments
    */
    Thread Starter regmanabq

    (@regmanabq)

    hey David, I was poking around a bit and ran across this.. just wanted to run it by you and see if that was right?? div id=”ttle”??

    line 80 in media-library-assistant/js/mla-inline-edit-upload-scripts.js
    te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton"

    Plugin Author David Lingren

    (@dglingren)

    This is excellent news – thank you for your three updates! I am very happy to hear you’ve met your application requirements using the hooks provided for the [mla_gallery] shortcode.

    Thank you as well for posting your code so others can benefit from it. I will consider something similar to your “edit media and edit upload” support for a future MLA version.

    Finally, ‘div id=”ttle”‘; I agree that looks a bit odd. Line 1 of media-library-assistant/js/mla-inline-edit-upload-scripts.js reads:

    // These functions are adapted from wp-admin/js/inline-edit-post.js

    If you look at /wp-admin/js/inline-edit-post.js you will find the same odd-looking code on line 93. I am merely following in the footsteps and building on the shoulders of the WordPress core team. I find a lot of their naming conventions, well, “unusual”, but I don’t make changes lightly.

    Thanks for posting your questions and working through the solutions with me. I hope you find the plugin a good addition to your WordPress toolbox. I am marking this topic resolved, but please update it or start a new topic if you have other questions or problems I can help with.

    Hi Guys,

    I really can’t decipher everything that you’re talking about and I certainly hope I don’t have to go through all of this because it ain’t gonna happen.

    I’ve been plugging away nicely on my blog and all of a sudden(yesterday)- I can’t add any attachment details to the media(photos) I’m uploading.

    The cursor will stall, not write anything nor will it delete anything. I NEED to post photos on this site, as it’s a food blog- and am extremely frustrated that I can’t find the answer to this anywhere but it looks similar to the issue tha tregmanabq was having?

    I updated to WP 4.0 3 days ago and installed a Yoast SEO plugin yesterday but it was still working fine until last night.

    Any ideas for me before I trash this whole thing? I have gotten nothing done today at all on my site.

    Plugin Author David Lingren

    (@dglingren)

    @adminfiveminmeals,

    Thank you for your question. This topic started with a simple bug report related to Media Library Assistant v1.93, and the most relevant answer in in my first reply, the second post in this topic. The other posts are a discussion about regmanabq’s application and do not apply to the original bug report.

    Unless you are using MLA v1.93, this topic won’t help you solve your problem. The symptoms you report, “The cursor will stall, not write anything nor will it delete anything.“, sound like some other issue unrelated to the bug that started this topic.

    If you are using MLA, you can try downloading the Development Version as described in my first response. You can also try disabling the MLA enhancements instead of deactivating MLA completely. Go to the Settings/Media Library Assistant General tab and scroll down to the “Media Manager/Media Grid Enhancements” section, then uncheck the first two boxes to prevent MLA from downloading any JavaScript to your browser. Scroll to the bottom and click “Save Changes” to save your work.

    If you are not using MLA, I am not sure I can be of much help. I will leave this topic unresolved for now in case you find MLA is the cause of your trouble and can give me an update on whether the above suggestions are helpful. Let me know how it goes, and thanks for your interest in the plugin.

    Hi David,

    Thanks for responding. Not using MLA, but this was the first topic that had the actual keywords in my issue that I’m trying to resolve.

    Any chance you might be able to point me in the right direction for some assistance on this?

    Thanks!

    Plugin Author David Lingren

    (@dglingren)

    I can only offer you some general advice.

    1. You can try deactivating plugins one at a time to see if one of them is causing the problem.
    2. You can try a different browser (unlikely) or activate the “Developer Tools” in your browser to see if there are JavaScript errors.
    3. You could try adding a line to your wp-config.php file to avoid the problem: define('CONCATENATE_SCRIPTS', false); This line must be above the ” require_once(ABSPATH . 'wp-settings.php'); line in the wp-config.php file.
    4. You could try adding define('COMPRESS_SCRIPTS', false); This will load the uncompressed versions of WordPress and plugin scripts.
    5. You could try adding define('WP_DEBUG', true); This will do all of the above and may produce additional PHP messages that give you more information.

    I regret the pain and inconvenience this problem is causing you. The WordPress eco-system is a thing of wonder, but it can be a mess when things go wrong. Good luck!

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘not saving caption / description data on upload’ is closed to new replies.