function new_duplicated_terms_filter($post_ids, $duplicates_only = true)
{
    global $wpdb, $sitepress, $wpml_admin_notices;
    require_once ICL_PLUGIN_PATH . '/inc/taxonomy-term-translation/wpml-term-hierarchy-duplication.class.php';
    $hier_dupl = new WPML_Term_Hierarchy_Duplication($wpdb, $sitepress);
    $taxonomies = $hier_dupl->duplicates_require_sync($post_ids, $duplicates_only);
    if ((bool) $taxonomies) {
        $text = __('<p>Some taxonomy terms are out of sync between languages. This means that content in some languages will not have the correct tags or categories.</p>
			 <p>In order to synchronize the taxonomies, you need to go over each of them from the following list and click the "Update taxonomy hierarchy" button.</p>', 'wpml-translation-management');
        $collapsed = 'Taxonomy sync problem';
        foreach ($taxonomies as $taxonomy) {
            $text .= '<p><a href="admin.php?page=' . ICL_PLUGIN_FOLDER . '/menu/taxonomy-translation.php&taxonomy=' . $taxonomy . '&sync=1">' . get_taxonomy_labels(get_taxonomy($taxonomy))->name . '</a></p>';
        }
        $text .= '<p align="right"><a target="_blank" href="https://wpml.org/documentation/getting-started-guide/translating-post-categories-and-custom-taxonomies/#synchronizing-hierarchical-taxonomies">Help about translating taxonomy >></a></p>';
        $notice = new WPML_Notice('wpml-taxonomy-hierarchy-sync', $text, 'wpml-core');
        $notice->set_css_class_types('info');
        $notice->set_collapsed_text($collapsed);
        $notice->set_hideable(false);
        $notice->set_dismissible(false);
        $notice->set_collapsable(true);
        $wpml_admin_notices->add_notice($notice);
    } else {
        remove_taxonomy_hierarchy_message();
    }
}
Example #2
0
function wpml_new_duplicated_terms_filter($post_ids, $duplicates_only = true)
{
    require_once ICL_PLUGIN_PATH . '/inc/taxonomy-term-translation/wpml-term-hierarchy-duplication.class.php';
    $hier_dupl = new WPML_Term_Hierarchy_Duplication();
    $taxonomies = $hier_dupl->duplicates_require_sync($post_ids, $duplicates_only);
    if ((bool) $taxonomies) {
        $text = __("The posts you just saved led to the creation of new hierarchical terms.\nTheir hierarchical relationship to one another is not yet synchronized with the original post's terms for the following taxonomies:", 'wpml-translation-management');
        $text = '<p>' . $text . '</p>';
        foreach ($taxonomies as $taxonomy) {
            $text .= '<p><a href="admin.php?page=' . ICL_PLUGIN_FOLDER . '/menu/taxonomy-translation.php&taxonomy=' . $taxonomy . '&sync=1">' . get_taxonomy_labels(get_taxonomy($taxonomy))->name . '</a></p>';
        }
        $message_args = array('id' => 'duplication-tm-dashboard-notification', 'text' => $text, 'type' => 'information', 'group' => 'duplication-notification', 'admin_notice' => true, 'show_once' => true, 'hide_per_user' => true);
        ICL_AdminNotifier::add_message($message_args);
    }
}