My Pledges: Mark up page with live data.

See #56
This commit is contained in:
Ian Dunn 2019-10-29 12:45:53 -07:00
parent 5c5ae83287
commit 858d70b045
No known key found for this signature in database
GPG key ID: 99B971B50343CBCB
3 changed files with 115 additions and 46 deletions

View file

@ -2,7 +2,7 @@
namespace WordPressDotOrg\FiveForTheFuture\Contributor;
use WordPressDotOrg\FiveForTheFuture;
use WordPressDotOrg\FiveForTheFuture\Pledge;
use WordPressDotOrg\FiveForTheFuture\{ Pledge, XProfile };
use WP_Error, WP_Post, WP_User;
defined( 'WPINC' ) || die();
@ -249,16 +249,25 @@ function get_contributor_user_objects( array $contributor_posts ) {
*/
function render_my_pledges() {
$user = wp_get_current_user();
$success_message = process_my_pledges_form();
$profile_data = XProfile\get_contributor_user_data( $user->ID );
$pledge_url = get_permalink( get_page_by_path( 'for-organizations' ) );
$success_message = process_my_pledges_form();
$contributor_posts = get_posts( array(
'title' => $user->user_login,
'post_type' => CPT_ID,
'post_title' => $user->user_login,
'post_status' => array( 'pending', 'publish' ),
'numberposts' => 100,
) );
$confirmed_pledge_ids = array_reduce( $contributor_posts, function( $carry, $post ) {
if ( 'publish' === $post->post_status ) {
$carry[] = $post->ID;
}
return $carry;
}, array() );
ob_start();
require FiveForTheFuture\get_views_path() . 'list-my-pledges.php';
return ob_get_clean();