Import unitaire, statut publié/pending et validation des idHAL
This commit is contained in:
@@ -50,6 +50,22 @@ class Thalim_HAL_Importer_Logic {
|
||||
)) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return ['id' => int, 'status' => string] for the post matching this hal_id, or null.
|
||||
*/
|
||||
public function get_imported_post($hal_id) {
|
||||
if (empty($hal_id)) return null;
|
||||
global $wpdb;
|
||||
$row = $wpdb->get_row($wpdb->prepare(
|
||||
"SELECT p.ID, p.post_status FROM {$wpdb->posts} p
|
||||
INNER JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID
|
||||
WHERE pm.meta_key = 'hal_id' AND pm.meta_value = %s
|
||||
LIMIT 1",
|
||||
$hal_id
|
||||
));
|
||||
return $row ? ['id' => (int) $row->ID, 'status' => $row->post_status] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get category ID for HAL doc type
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user