66 lines
1.9 KiB
PHP
66 lines
1.9 KiB
PHP
<?php
|
|
$current_user = wp_get_current_user();
|
|
$user_name = $current_user->user_login;
|
|
|
|
$args = array(
|
|
'post_type' => 'artisans',
|
|
'post_status' => array('publish', 'offline'),
|
|
'meta_key' => 'conseiller',
|
|
'meta_value' => $current_user->ID,
|
|
'posts_per_page' => -1
|
|
);
|
|
|
|
$user_attached_artisans = new WP_Query($args);
|
|
|
|
$required_actions_artisans = new WP_Query(
|
|
array(
|
|
'post_type' => 'artisans',
|
|
'meta_key' => 'conseiller',
|
|
'meta_value' => $current_user->ID,
|
|
'meta_query' => array(
|
|
array(
|
|
'key' => 'required_action',
|
|
'value' => true,
|
|
'compare' => '='
|
|
)
|
|
),
|
|
'posts_per_page' => -1
|
|
)
|
|
);
|
|
|
|
$posts_to_show = 5;
|
|
|
|
?>
|
|
<h3>Bonjour <?php echo $user_name ?> !</h3>
|
|
<div class="total-attached">
|
|
<p> Artisans associés : <?php echo count($user_attached_artisans->posts) ?></p>
|
|
</div>
|
|
<!-- <div class="required-actions">
|
|
<?php
|
|
$total = count($required_actions_artisans->posts);
|
|
?>
|
|
<?php if ($total == 0) : ?>
|
|
<p>Aucun artisan en attente d'action</p>
|
|
<?php else : ?>
|
|
<h4>Actions requises<span class="count">(<?php echo $total ?>)</span></h4>
|
|
<?php endif; ?>
|
|
|
|
<ul>
|
|
<?php foreach ($required_actions_artisans->posts as $index => $artisan) : ?>
|
|
<?php if ($index >= $posts_to_show ) break; ?>
|
|
<?php $mdp_status = get_field('mdp_status', $artisan->ID); ?>
|
|
<li>
|
|
<a href="<?php echo get_edit_post_link($artisan->ID) ?>">
|
|
<?php echo $artisan->post_title ?>
|
|
</a>
|
|
<span class="status-state status-state--<?php echo $mdp_status['value'] ?>"><?php echo $mdp_status['label'] ?></span>
|
|
</li>
|
|
<?php if ($index === $posts_to_show - 1) : ?>
|
|
<p>et <?php echo $total - $posts_to_show ?> artisan(s) de plus ...</p>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</div> -->
|
|
|
|
<a class="cta cta--button" href="<?php echo home_url('/wp-admin/admin.php?page=gestion-artisans') ?>">Panel de gestion</a>
|
|
<?php
|