mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-13 05:45:47 +03:00
Add a Contributor custom post type (#42)
Contributors associated with pledges have a state: they can be confirmed or unconfirmed. They also have some important meta data, namely when they were confirmed. Thus, managing contributor data for pledges is more robust if we treat them as their own post type instead of as a multidimensional array of post meta data. This also reorganizes some of the functions related to pledges so that things are more consistent between the pledge CPT and the contributior CPT. Fixes #11
This commit is contained in:
parent
2927532544
commit
266ba447b4
6 changed files with 265 additions and 66 deletions
|
@ -15,8 +15,8 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
|||
<input
|
||||
type="text"
|
||||
id="5ftf-pledge-contributors"
|
||||
name="org-pledge-contributors"
|
||||
value="<?php echo esc_attr( $data['org-pledge-contributors'] ); ?>"
|
||||
name="pledge-contributors"
|
||||
value="<?php echo esc_attr( $data['pledge-contributors'] ); ?>"
|
||||
required
|
||||
aria-describedby="5ftf-pledge-contributors-help"
|
||||
/>
|
||||
|
@ -28,7 +28,49 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
|||
<?php else : ?>
|
||||
|
||||
<div class="5ftf-contributors">
|
||||
<?php foreach ( $contributors as $status => $group ) : ?>
|
||||
<?php if ( ! empty( $group ) ) : ?>
|
||||
<h3 class="contributor-list-heading">
|
||||
<?php
|
||||
switch ( $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( $status ); ?>">
|
||||
<?php foreach ( $group as $contributor_post ) :
|
||||
$contributor = get_user_by( 'login', $contributor_post->post_title );
|
||||
?>
|
||||
<li>
|
||||
<?php echo get_avatar( $contributor->user_email, 32 ); ?>
|
||||
<?php echo $contributor_post->post_title; ?>
|
||||
<!-- TODO These buttons don't do anything yet.
|
||||
<button class="button-primary" data-action="remove" data-contributor-post="<?php echo esc_attr( $contributor_post->ID ); ?>">
|
||||
<?php esc_html_e( 'Remove', 'wporg' ); ?>
|
||||
</button>
|
||||
<?php if ( 'pending' === $contributor_post->post_status ) : ?>
|
||||
<button class="button-secondary" data-action="resend-confirmation" data-contributor-post="<?php echo esc_attr( $contributor_post->ID ); ?>">
|
||||
<?php esc_html_e( 'Resend confirmation', 'wporg' ); ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
-->
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<?php endif; ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue