five-for-the-future/plugins/wporg-5ftf/views/manage-contributors.php

73 lines
2.4 KiB
PHP
Raw Normal View History

<?php
namespace WordPressDotOrg\FiveForTheFuture\View;
/** @var array $contributors */
/** @var array $data */
/** @var bool $readonly */
?>
2019-11-12 23:18:16 +02:00
<div id="5ftf-contributors">
<?php if ( ! empty( $contributors ) ) : ?>
<?php foreach ( $contributors as $contributor_status => $group ) : ?>
<?php if ( ! empty( $group ) ) : ?>
<h3 class="contributor-list-heading">
<?php
switch ( $contributor_status ) {
case 'pending':
esc_html_e( 'Unconfirmed', 'wporg' );
break;
case 'publish':
esc_html_e( 'Confirmed', 'wporg' );
break;
}
?>
</h3>
<ul class="contributor-list <?php echo esc_attr( $contributor_status ); ?>">
<?php foreach ( $group as $contributor_post ) :
$name = $contributor_post->post_title;
$contributor = get_user_by( 'login', $name );
$remove_confirm = sprintf( __( 'Remove %s from this pledge?', 'wporg-5ftf' ), $name );
$remove_label = sprintf( __( 'Remove %s', 'wporg' ), $name );
?>
<li>
<button
class="button-link button-link-delete"
data-action="remove-contributor"
data-pledge-post="<?php the_ID(); ?>"
data-contributor-post="<?php echo esc_attr( $contributor_post->ID ); ?>"
data-confirm="<?php echo esc_attr( $remove_confirm ); ?>"
aria-label="<?php echo esc_attr( $remove_label ); ?>"
>
2019-11-12 19:33:32 +02:00
<span class="dashicons dashicons-no-alt" aria-hidden="true"></span>
</button>
2019-11-12 19:33:32 +02:00
<?php echo get_avatar( $contributor->user_email, 32 ); ?>
<span class="contributor-list__name">
<?php echo esc_html( $name ); ?>
2019-11-12 19:33:32 +02:00
</span>
<?php if ( 'pending' === $contributor_post->post_status ) : ?>
<button
class="button"
data-action="resend-contributor-confirmation"
data-pledge-post="<?php the_ID(); ?>"
data-contributor-post="<?php echo esc_attr( $contributor_post->ID ); ?>"
>
2019-11-12 19:33:32 +02:00
<?php esc_html_e( 'Resend Confirmation', 'wporg' ); ?>
</button>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endforeach; ?>
<?php else : ?>
<p><?php esc_html_e( 'There are no contributors added to this pledge yet.', 'wporg' ); ?></p>
<?php endif; ?>
<!-- TODO This button doesn't do anything yet.
<button class="button-primary" data-action="add-contributor">
<?php esc_html_e( 'Add new contributor', 'wporg' ); ?>
</button>
-->
</div>