donation_fields()->get_data_type_fields( 'user' ); return array_combine( array_keys( $fields ), wp_list_pluck( $fields, 'label' ) ); } /** * Return the list of user donation field options. * * @since 1.7.0.7 * * @return string[] */ protected function get_campaign_list( $include_donations = false ) { $campaigns = array(); $args = array( 'posts_per_page' => -1, 'orderby' => 'post_title', 'order' => 'ASC', 'fields' => array('post_title', 'ID') ); $results = Charitable_Campaigns::query( $args ); if ( empty( $results->posts ) ) { return array(); } foreach ( $results->posts as $index => $post ) : $campaigns[ $post->ID ] = $post->post_title; if ( $include_donations ) { $donations = charitable_get_table( 'campaign_donations' )->get_donations_on_campaign( $post->ID ); $donation_count = count( $donations ); $plural = ( ( $donation_count > 1 ) || 0 === $donation_count ) ? 's' : ''; $campaigns[ $post->ID ] = $post->post_title . ' (' . count( $donations ) . ' donation' . $plural . ') '; } endforeach; return( $campaigns ); } } endif;