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.
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.
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.
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?
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.
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 :/
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.
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?
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.
Thank you so much David! Can’t wait to see people saying that it works fine π