LEFT JOIN {$this->wpdb->prefix}icl_translation_status ts ON it.translation_id = ts.translation_id WHERE it.trid = %d AND it.language_code = %s LIMIT 1", $wpml_post_translations->get_element_trid ( $post_id ), $wpml_post_translations->get_element_lang_code ( $post_id ) ) ); if ( $translation_id->status_id && $translation_id->transid ) { $res = $this->wpdb->update ( $this->wpdb->prefix . 'icl_translation_status', array( 'status' => $status ), array( 'translation_id' => $translation_id->transid ) ); $this->status[ $post_id ] = $status; } else { $res = $this->wpdb->insert ( $this->wpdb->prefix . 'icl_translation_status', array( 'status' => $status, 'translation_id' => $translation_id->transid ) ); } do_action( 'wpml_translation_status_update', array( 'post_id' => $post_id, 'type' => 'status', 'value' => $status ) ); return isset( $res ); } public function get_status( $post_id, $trid = false, $lang_code = false ) { global $wpml_post_translations; $trid = $trid !== false ? $trid : $wpml_post_translations->get_element_trid ( $post_id ); $lang_code = $lang_code !== false ? $lang_code : $wpml_post_translations->get_element_lang_code ( $post_id ); $post_id = $post_id ? $post_id : $wpml_post_translations->get_element_id ( $lang_code, $trid ); if ( !$post_id ) { $status = ICL_TM_NOT_TRANSLATED; $post_id = $lang_code . $trid; } else { $status = $this->is_duplicate( $post_id ) ? ICL_TM_DUPLICATE : ( $this->needs_update ( $post_id ) ? ICL_TM_NEEDS_UPDATE : ICL_TM_COMPLETE ); } $status = apply_filters ( 'wpml_translation_status', $status, $trid, $lang_code, true ); $this->status[ $post_id ] = $status; return $status; } public function is_duplicate( $post_id ) { return (bool) $this->wp_api->get_post_meta ( $post_id, '_icl_lang_duplicate_of', true ); } }