Let’s try adding my two patches here. Hope the code comes out all right.
First, the sitepress.class.php file must be patched in order to ignore empty $_POST arrays. If this is not done a warning could be triggered that will prevent the page from refreshing properly when broadcasting.
diff --git a/sitepress.class.php b/sitepress.class.php
index d253d64..f496005 100644
--- a/sitepress.class.php
+++ b/sitepress.class.php
@@ -2840,6 +2840,10 @@ class SitePress
function save_post_actions( $pidd, $post )
{
+ // If there is no POST because save_post was called by a 3rd party plugin, do not try to do any translation.
+ if ( count( $_POST ) < 1 )
+ return;
+
global $wpdb;
wp_defer_term_counting( true );
Next we have to patch the translation-management.class.php file in order to correctly notify Broadcast that translation has been completed. If this is not done the hook will never be called, due to incorrect placement, and Broadcast will not know that it is time to Broadcast the completed translation.
diff --git a/inc/translation-management/translation-management.class.php b/inc/translation-management/translation-management.class.php
index 35c6f7f..29e4df9 100644
--- a/inc/translation-management/translation-management.class.php
+++ b/inc/translation-management/translation-management.class.php
@@ -3607,6 +3607,9 @@ class TranslationManagement{
}
}
+ // Tell other plugins that this translation has been completed, before we redirect.
+ do_action('icl_pro_translation_completed', $new_post_id);
+
self::set_page_url($new_post_id);
// redirect to jobs list
@@ -3616,9 +3619,6 @@ class TranslationManagement{
}else{
$this->messages[] = array('type'=>'updated', 'text' => __('Translation (incomplete) saved.', 'sitepress'));
}
-
- do_action('icl_pro_translation_completed', $new_post_id);
-
}
// returns a front end link to a post according to the user access
Info taken from: https://plugins.plainview.se/threewp-broadcast-premium-pack/wpml-broadcast-plugin/
I have a third patch that adds to the translation managers edit_advanced_form hook: it adds another hook in order for the WPML Broadcast plugin to hook into exactly the translation manager’s form, instead of every single advanced form in WordPress, but I’m not so sure it’s really important. The first two are, though.
Also: I remember needing to fix the default language during posting, but I can’t remember for whom I fixed it, nor when. Since nobody is complaining I WPML fixed it… But I not sure. I trust all y’all will keep me informed. ??