WPML – Auto Duplicate Post Issue

The problem is that you are unsetting the default language form $langs array, so when you loop over $langs to make the duplicates, the default language is never included. This may be the cause of your problem (nothing to do with WordPress by the way).

function wpml_duplicate_on_publish($post_id) {
    global $post, $sitepress, $iclTranslationManagement;

    // don't save for autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return $post_id;
    }
    // save only for campaign
    if (isset($post->post_type) && $post->post_type != 'vehicle') {
        return $post_id;
    }

    // get languages
    $langs = $sitepress->get_active_languages();

    // Unseeting the default lenguage was the problem
    // unset($langs[$sitepress->get_default_language()]);

    // unhook this function so it doesn't loop infinitely
    remove_action('save_post', 'wpml_translate_post');

    // make duplicates if the post being saved does not have any already or is not a duplicate of another
    $has_duplicates = $iclTranslationManagement->get_duplicates($post_id);
    $is_duplicate = get_post_meta($post_id, '_icl_lang_duplicate_of', true);

    if (!$is_duplicate && !$has_duplicates) {
        //now lets create duplicates of all new posts in all languages used for translations
        foreach ($langs as $language_code => $v) {
            $iclTranslationManagement->make_duplicate($post_id, $language_code);
        }
    }
}

add_action('wpuf_add_post_after_insert', 'wpml_duplicate_on_publish');

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)