David Garcia Watkins
Forum Replies Created
-
Forum: Plugins
In reply to: [PowerPress Podcasting plugin by Blubrry] WPML compatibilityHi,
This is David from WPML compatibility team.
I worked a bit further in the integration and came up with the following solution (based on Bobby’s code shared earlier).
1) The “cleanest” way to integrate this is that you add a couple of filters in the playlist query, for example like this (in patch format):
diff --git a/powerpress-playlist.php b/powerpress-playlist.php index b93c01b..24adc03 100644 --- a/powerpress-playlist.php +++ b/powerpress-playlist.php @@ -129,12 +129,12 @@ function powerpress_playlist_episodes($args) // Start the SQL query $query = "SELECT p.ID, p.post_title, p.post_date, pm.meta_value "; $query .= "FROM {$wpdb->posts} AS p "; - $query .= "INNER JOIN {$wpdb->postmeta} AS pm ON p.ID = pm.post_id "; + $query .= apply_filters( 'powerpress_join', "INNER JOIN {$wpdb->postmeta} AS pm ON p.ID = pm.post_id " ); if( !empty($TaxonomyObj->term_taxonomy_id) ) $query .= "INNER JOIN {$wpdb->term_relationships} AS tr ON p.ID = tr.object_id "; - $query .= "WHERE (pm.meta_key = %s) "; + $query .= apply_filters( 'powerpress_where', "WHERE (pm.meta_key = %s) " ); $query .= "AND p.post_type = %s "; $query .= "AND p.post_status = 'publish' "; if( !empty($TaxonomyObj->term_taxonomy_id) ) {
2) With these filters we can hook when WPML is active and adjust the query accordingly:
if ( apply_filters( 'wpml_setting', false, 'setup_complete' ) ) { add_filter( 'powerpress_join', function( $join ) { global $wpdb; $join .= "JOIN {$wpdb->prefix}icl_translations ON element_type = CONCAT('post_', p.post_type) AND element_id = p.ID "; return $join; } ); add_filter( 'powerpress_where', function( $where ) { $lang = apply_filters( 'wpml_current_language', false ); $where .= "AND language_code = '$lang' "; return $where; } ); }
3) It would also be interesting to add a language configuration file so that WPML copies the ‘enclosure’ field to translations. Just drop a
wpml-config.xml
file in the root folder of your plugin with this in it:<wpml-config> <custom-fields> <custom-field action="copy">enclosure</custom-field> </custom-fields> </wpml-config>
Lastly, if you would like to join our Go Global program, we can test both plugins to see if anything else needs adjusting:
https://wpml.org/documentation/theme-compatibility/go-global-program/
Best,
David- This reply was modified 5 years, 4 months ago by David Garcia Watkins.
Forum: Plugins
In reply to: [WP Better Permalinks] WPML compatibilityJust now looking, I noticed that the translated term URL is not correct, but at least it works. So these changes may still require some tweaking.
Forum: Plugins
In reply to: [WP Better Permalinks] WPML compatibilityIt is the only problem our shared users have reported so far.
Let me mention that if you decide to join Go Global we will test the plugin thoroughly and find out any other glitches there may be.
I have prepared a SandBox site for you to take a look (it will expire in 7 days after last login):
https://naughty-bear.w5.wpsandbox.pro?upass=Rn97jX04NtYkHere you have 2 versions of your plugin (the original one, and one with the changes above). Feel free to switch from one to another.
Terms permalinks:
https://naughty-bear.w5.wpsandbox.pro/book/fiction/
https://naughty-bear.w5.wpsandbox.pro/es/genero/ficcion/Post permalinks:
https://naughty-bear.w5.wpsandbox.pro/book/fiction/hitchhikers-guide-to-the-galaxy/
https://naughty-bear.w5.wpsandbox.pro/es/libro/ficcion/guia-del-autoestopista-estelar/You can see how all the components of the URL are translated and they work.
If there is any other feature you’d like to test please go ahead.- This reply was modified 5 years, 5 months ago by David Garcia Watkins.
- This reply was modified 5 years, 5 months ago by David Garcia Watkins.
Forum: Plugins
In reply to: [WP Better Permalinks] WPML compatibilityYes, thats right
Forum: Plugins
In reply to: [WP Better Permalinks] WPML compatibilityIf you setup WPML with languages in directories, all the permalinks in second language stop working.
https://localhost/sample-page/ works
https://localhost/es/pagina-de-ejemplo/ does not work.It caused by having
es/
in the rewrite rule regex.
Removing it fixes everything.There are cleaner ways to implement this code:
– We could detect if WPML is running with:
https://wpml.org/wpml-hook/wpml_setting/
– Then hook on the appropriate filter to adjust the regex.If you need help here, please signup to our GoGlobal program and we will help you through:
https://wpml.org/documentation/theme-compatibility/go-global-program/Forum: Plugins
In reply to: [WP Better Permalinks] WPML compatibilityYes, you’re right. It also fails on custom taxonomies.
Likewise, edit functions/terms/rewrites.php around line 35. Change this:
foreach ($this->core->terms->options['terms'] as $rewrite) {
to this:
foreach ($this->core->terms->options['terms'] as $term_id => $rewrite) { $term = get_term( $term_id ); if ( ! is_wp_error( $term ) ) { $lang = apply_filters('wpml_element_language_code', null, array('element_id' => $term_id, 'element_type' => $term->taxonomy ) ); $home_url = apply_filters('wpml_permalink', home_url(), $lang); $path = substr(trailingslashit(parse_url($home_url, PHP_URL_PATH)),1); $rewrite['regex'] = preg_replace("~^$path~", '', $rewrite['regex'], 1); }
I would also like to mention our Go Global program:
https://wpml.org/documentation/theme-compatibility/go-global-program/
I think you might find it interesting.Forum: Plugins
In reply to: [Speed Contact Bar] WPML compatibilityWe tested with the new version and it works fine.
Thanks!Forum: Plugins
In reply to: [Speed Contact Bar] WPML compatibilityI suspect you re-enabled WPML on an old site or something like that.
I think you will be better off trying this on a fresh WordPress setup to avoid getting caught in un-related problems like this.
The strings we need to translation are the plugin options strings. The ones that are in the actual bar.
Let me know how it goes.
Thanks
DavidForum: Plugins
In reply to: [Speed Contact Bar] WPML compatibilityIf you need a developer WPML subscription to test things you can sign up to our Go Global program and we will provide you with one:
https://wpml.org/documentation/theme-compatibility/go-global-program/
Thanks!
Forum: Plugins
In reply to: [Contact Form 7] Fix for WPML integrationI believe the fix is a generic one, not just for WPML.
Anyone hooking on that filter will have the same issue.But we will handle it on our side anyway, no problem.
Thanks for your reply.
Forum: Plugins
In reply to: [WooCommerce Quickpay] WooCommerce QuickPay and WPML compatibilityHi Linda
In the issue I am reporting here, the callback URL works in both languages.
The problem is only that strings are translated or not.I’m sorry but I don’t think this has anything to do with your problem.
Feel free to open a support ticket in the WPML forum and we’ll see what we can do:
https://wpml.org/forums/forum/english-support/
- This reply was modified 6 years ago by David Garcia Watkins.
Forum: Plugins
In reply to: [WP Fastest Cache] Fix for WPML compatibilityWe tested the development version of WP Fastest cache in both, “different directory” and “different domain” URL Language formats.
It works without issues or errors and the cache files are created correctly.
Thanks for the speedy response!
Forum: Plugins
In reply to: [Theme My Login] Login redirection with WPMLI ended up publishing this information on our website:
https://wpml.org/errata/theme-my-login-redirects-to-login-page-in-the-wrong-language/
Thank you for your attention.
Forum: Plugins
In reply to: [Theme My Login] Login redirection with WPMLVery sharp ??
I meant to say the percentage of the total
- This reply was modified 6 years, 9 months ago by David Garcia Watkins.
- This reply was modified 6 years, 9 months ago by David Garcia Watkins.
Forum: Plugins
In reply to: [Theme My Login] Login redirection with WPMLNot enough of our users use theme-my-login to justify including compatibility code in our core plugin. But maybe you have enough WPML users to do it, I don’t know. Thats why I ask.
If not, we will probably end up publishing a “known issue” on our site so we can point our common users to it:
https://wpml.org/known-issues/Let me know what you decide, all I want our common users to have a better experience.
- This reply was modified 6 years, 9 months ago by David Garcia Watkins.