Add real contributors to the pledges

This commit is contained in:
Kelly Dwan 2019-10-24 16:45:57 -04:00
parent c11eff4522
commit e1e5c22654
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D

View file

@ -5,6 +5,7 @@
namespace WordPressdotorg\Five_for_the_Future\Theme; namespace WordPressdotorg\Five_for_the_Future\Theme;
use WordPressDotOrg\FiveForTheFuture\Contributor;
use WordPressDotOrg\FiveForTheFuture\PledgeMeta; use WordPressDotOrg\FiveForTheFuture\PledgeMeta;
$data = array(); $data = array();
@ -13,8 +14,7 @@ foreach ( PledgeMeta\get_pledge_meta_config() as $key => $config ) {
$data[ $key ] = get_post_meta( get_the_ID(), PledgeMeta\META_PREFIX . $key, $config['single'] ); $data[ $key ] = get_post_meta( get_the_ID(), PledgeMeta\META_PREFIX . $key, $config['single'] );
} }
// @todo Get real contributors from the post. $contributors = Contributor\get_pledge_contributors( get_the_ID() );
$contributors = array();
$count = count( $contributors ); $count = count( $contributors );
$content = apply_filters( 'the_content', $data['org-description'] ); $content = apply_filters( 'the_content', $data['org-description'] );
@ -60,11 +60,17 @@ $contributor_title = sprintf(
<?php /* phpcs:ignore -- escaped above */ ?> <?php /* phpcs:ignore -- escaped above */ ?>
<h3><?php echo $contributor_title ?></h3> <h3><?php echo $contributor_title ?></h3>
<?php foreach ( $contributors as $contrib_email ) : ?> <?php
<span class="pledge-contributor__avatar"> foreach ( $contributors as $contrib_post ) {
<?php echo get_avatar( $contrib_email, 30, 'blank' ); ?> $contrib = get_user_by( 'login', $contrib_post->post_title );
</span> if ( $contrib ) {
<?php endforeach; ?> printf(
'<span class="pledge-contributor__avatar">%s</span>',
get_avatar( $contrib->user_email, 30, 'blank' )
);
}
}
?>
</div><!-- .pledge-contributors --> </div><!-- .pledge-contributors -->
</div><!-- .entry-content --> </div><!-- .entry-content -->