diff --git a/template-parts/admin/artisans-section-group.php b/template-parts/admin/artisans-section-group.php index 95f5d53..00c92a6 100644 --- a/template-parts/admin/artisans-section-group.php +++ b/template-parts/admin/artisans-section-group.php @@ -19,37 +19,40 @@ $current_user_id = $args['current_user_id'] ?? null; $not_found_message = $args['not_found_message'] ?? ""; -$queryArgsWithStatus = array( +$queryAllUnaffectedArtisansByStatus = array( 'post_type' => 'artisans', 'posts_per_page' => -1, + 'meta_query' => array( + 'relation' => 'AND', + array( + 'key' => 'mdp_status', + 'value' => $status, + 'compare' => '=' + ), + array( + 'key' => 'conseiller', + 'compare' => 'NOT EXISTS' + ) + ) +); + +$queryConseillerRelatedArtisansByStatus = array( + 'post_type' => 'artisans', + 'posts_per_page' => -1, + 'meta_key' => 'conseiller', + 'meta_value' => $current_user_id, 'meta_query' => array( array( 'key' => 'mdp_status', 'value' => $status, 'compare' => '=' - ) - ) -); -$queryArgsActionRequired = array( - 'post_type' => 'artisans', - 'posts_per_page' => -1, - 'meta_query' => array( - array( - 'key' => 'required_action', - 'value' => true, - 'compare' => '=' - ) + ), ) ); -$currentQueryArgs = $status ? $queryArgsWithStatus : $queryArgsActionRequired; - -if ($use_current_user && $current_user_id) { - $currentQueryArgs['meta_value'] = $current_user_id; - $currentQueryArgs['meta_key'] = 'conseiller'; -} +$currentQueryArgs = ($use_current_user && $current_user_id) ? $queryConseillerRelatedArtisansByStatus : $queryAllUnaffectedArtisansByStatus; $artisans = new WP_Query($currentQueryArgs); @@ -61,13 +64,37 @@ $artisans = new WP_Query($currentQueryArgs); found_posts === 0) : ?>
+Nom
+Dernière action
+Commentaire
+Statut
+