• Resolved Jordy Meow

    (@tigroumeow)


    Hey David,

    Nice to meet you. We both are developers and travelers it seems, only I am not retired yet πŸ™‚ I am the author of a few plugins and among them there is WP/LR Sync (https://wordpress.org/plugins/wplr-sync/), that brings synchronization between Lightroom and WordPress. Many of my users are using your plugin as well and love it. After playing with your plugin for a while, I will definitely recommend it and I will not hesitate to work with you when needed.

    Now, a question πŸ™‚ My plugin does the mapping between IPTC/EXIF to the WP fields as well, but on the Lightroom side. I wouldn’t do it on the WordPress side because simply your plugin is doing it already and it does it well (and I am for smaller and stronger plugins, working with each other, rather than a high-priced do-it-all kind of plugin with robotic support and old code). So it’s either my users do it simply and doing that mapping on LR is fine, or they want to do a bit more and they would use your plugin.

    However! Your mapping functions are not triggered when adding or updating media through my plugin. It seems you are doing it when wp_generate_attachment_metadata / wp_update_attachment_metadata are called and I do this. Maybe you need something else more to get triggered. My plugin also performs an action “wplr_add_media” or “wplr_update_media” after it has added or updated a media (first argument is the media ID). So that could be a way to trigger this on your side if you are willing to add support for my plugin.

    Another thing, I live in Japan (though I am French) and can’t see your website. Seems like I can’t see it in my country. Mmm? I will check it out later through a VPN but I was surprised and thought I would mention it.

    Cheers and nice to meet you!
    Jordy.

    https://wordpress.org/plugins/media-library-assistant/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your kind words and your question. I’ve had a quick look at the WP/LR Synch plugin and it looks great.

    I must confess that I am not a photographer and have never invested in a copy of Adobe Lightroom for myself. This limits my abilities to test the operation of your plugins and investigate the issue you’re experiencing.

    First, just to confirm, have you checked the “Enable … mapping when adding/updating media” boxes on the Settings/Media Library Assistant “IPTC/EXIF” and “Custom Fields” tabs? They aren’t checked by default.

    Second, the most likely cause I can think of is that the MLA code to hook the WordPress filters and perform mapping are not loaded when your plugin does its work. A few versions back I added code to selectively load MLA components for “front end” and Ajax requests to reduce time and memory requirements in those contexts. If your plugin is running in the “DOING_AJAX” context it’s quite likely that the MLA code is missing. Have a look around lines 84 to 122 in the /includes/mla-plugin-oader.php file.

    If that’s the case I can add some code to load the MLA support when necessary. You could help by giving me the criteria I can use to determine when WP/LR Synch is updating metadata and needs the mapping support. Any additional information you can give me will be useful.

    Finally, I regret the trouble you’ve had accessing the FTJ site. We have been subjected to serious hacks/attacks from Japan in the past. Since Japan isn’t an important market for us we blocked access to the site from there. I have removed the block so you can access the site. Let me know if you still have any problems doing so.

    I will leave this topic unresolved until I hear back from you. Thanks for your interest in the cooperation between our plugins.

    Plugin Author David Lingren

    (@dglingren)

    It has been a month since the last post in this topic. Have you found a solution to your problem? Regarding the DOING_AJAX hypothesis, you might be able to apply a fix I developed for a similar topic:

    Automatically adding the author as a category

    If you can find the “action” used by WP/LR Synch you can modify your wp-config.php file and see if loading the full MLA code resolves your issue. Let me know if that helps.

    Plugin Author David Lingren

    (@dglingren)

    You may be interested in this new topic regarding WP/LR synchronization:

    Update Title with Caption upon import

    It would be great to know if you are still having trouble with the MLA mapping rules cooperating with your plugin.

    Thread Starter Jordy Meow

    (@tigroumeow)

    Hello David,

    Sorry for such a late reply, I went to China and was robbed, then I had to stay two weeks more there, and now I am overloaded with work, support and all πŸ˜‰ A little mess but I am fine.

    I have tried using “define( ‘MLA_AJAX_EXCEPTIONS’, ‘wfu_ajax_action,upload_ugc’ )”, but it doesn’t work for me.

    What I am having now is a custom field created by your plugin, using some IPTC field in the image. If I upload the image directly, it works, through my plugin, it doesn’t. It might be indeed because the DOING_AJAX, but your solution with the above define didn’t do it for me, and I am not really using AJAX, I am using the WP-API (but that might be considered equivalent and DOING_AJAX). On what kind of actions/filters your plugin start doing its mappings?

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your response – I am so sorry to hear of your troubles in China! I can emphasize with the backlog caused by travels, and I hope you get caught up soon.

    The constant might work for you, but the values are specific to each plugin that uses Ajax for its work. The values in the example you tried are specific to some other front-end file uploader plugins.

    I found these Ajax handlers in your code:

    add_action( 'wp_ajax_wplrsync_link', array( $this, 'wplrsync_link' ) );
    add_action( 'wp_ajax_wplrsync_unlink', array( $this, 'wplrsync_unlink' ) );
    add_action( 'wp_ajax_wplrsync_clean', array( $this, 'wplrsync_clean' ) );
    add_action( 'wp_ajax_wplrsync_extensions_reset', array( $this, 'wplrsync_extensions_reset' ) );
    add_action( 'wp_ajax_wplrsync_extensions_init', array( $this, 'wplrsync_extensions_init' ) );
    add_action( 'wp_ajax_wplrsync_extensions_query', array( $this, 'wplrsync_extensions_query' ) );

    That means your definition should be something like this:

    define( 'MLA_AJAX_EXCEPTIONS', 'wplrsync_link,wplrsync_unlink,wplrsync_clean,wplrsync_extensions_reset,wplrsync_extensions_init,wplrsync_extensions_query' );

    or whatever subset of those actions require MLA support. Give that a try and let me know if you get better results.

    Thread Starter Jordy Meow

    (@tigroumeow)

    Hi David,

    I have tried, but with a slightly different definition, this one:

    define( 'MLA_AJAX_EXCEPTIONS', 'ping,presync,sync,sync_collection,list,delete,delete_collection,list_unlinks,link,unlink,linkinfo,linkinfo_upload,userinfo,list_wpids' );

    The other you found are only used in the admin (but I guess they need to be part of MLA_AJAX_EXCEPTIONS). The important ones are above because they are part of the API used by the Lightroom plugin.

    Anyway, the problem here (probably) is that this MLA_AJAX_EXCEPTIONS is not enough and you plugin might be skipped during the WP-API/WP-JSON operations :/

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update and the additional investigation/experiments you have done. I looked through your plugin’s code and found class Meow_WPLR_Sync_API – it looks like this is the class you use for the “WP-API/WP-JSON” operations; is that right? If so, it looks like you mean the WordPress REST API, right?

    I haven’t worked with the REST API, but I can try to work with you on it. All of MLA’s decisions on which modules to load and which hooks to register are made in the includes/mla-plugin-loader.php file. This file runs when the plugin is loaded, so hooking your “wplr_add_media” or “wplr_update_media” actions will not help.

    When the mla-plugin-loader.php files runs, constants like WP_ADMIN, DOING_AJAX and XMLRPC_REQUEST are defined, and MLA uses them to make its decisions. You can see this in lines 82 to 133 of the file. The XML_RPC calls already load the full MLA support, and the MLA_AJAX_EXCEPTIONS work is done here, too.

    If there is a similar way to identify a REST API call and something like MLA_REST_EXCEPTIONS I could add to detect your API calls I can modify mla-plugin-loader.php to load the support you need. Any details you can provide would be very helpful. It would be best to work through this offline; I will post a summary here when there is progress to report. You can give me your contact information through the Contact Us page at our web site:

    Fair Trade Judaica/Contact Us

    Do not post your e-mail address in the forum; personal details in a public forum violates WordPress guidelines. I look forward to hearing from you.

    Thread Starter Jordy Meow

    (@tigroumeow)

    Ok, sent you an email πŸ™‚

    Yes indeed, I am using the WP REST API. I came accross this thread here: https://github.com/WP-API/WP-API/issues/926. Looks like you could check if REST_REQUEST is set, the same way as DOING_AJAX?

    Plugin Author David Lingren

    (@dglingren)

    I have released MLA version 2.40, which includes support for metadata mapping when files are uploaded with the REST API.

    I am marking this topic resolved, but please work with me by email if you have problems or further questions regarding the new release. Thanks for your help with this topic.

    Thread Starter Jordy Meow

    (@tigroumeow)

    Thank you so much David! Can’t wait to see people saying that it works fine πŸ™‚

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

The topic ‘Support for WP/LR Sync Hi ;)’ is closed to new replies.