/**
 * Add extra submitted fields to the Funds Recipient tab in the campaign admin page.
 *
 * @param   array $data
 * @param   Charitable_Campaign $campaign
 * @return  array $data
 */
function ed_add_campaign_funding_data($data, Charitable_Campaign $campaign)
{
    // Get the data that was submitted when the campaign was added.
    $submitted = $campaign->get('submission_data');
    $campaign_form = new Charitable_Ambassadors_Campaign_Form();
    // Go through all user fields and add their value to the list of fields to display.
    foreach ($campaign_form->get_user_fields() as $key => $field) {
        $data[$key] = array('label' => isset($field['label']) ? $field['label'] : $key, 'value' => isset($submitted[$key]) ? $submitted[$key] : '-');
    }
    return $data;
}
/**
 * Add a gallery field to the campaign submission form.
 *
 * @param   array                                $fields
 * @param   Charitable_Ambassadors_Campaign_Form $form
 * @return  array
 */
function ed_charitable_add_campaign_gallery_field($fields, $form)
{
    $campaign = $form->get_campaign();
    if ($campaign) {
        $campaign_id = $campaign->ID;
        $gallery = $campaign->get('gallery');
    } else {
        $campaign_id = 0;
        $gallery = isset($_POST['gallery']) ? $_POST['gallery'] : '';
    }
    $fields['gallery'] = array('label' => __('Gallery', 'your-namespace'), 'type' => 'picture', 'priority' => 17, 'required' => false, 'fullwidth' => true, 'size' => 70, 'uploader' => true, 'max_uploads' => 5, 'parent_id' => $campaign_id, 'value' => $gallery, 'data_type' => 'meta', 'page' => 'campaign_details', 'help' => __('Upload one to five photos to display on your campaign page as a gallery.', 'your-namespace'));
    return $fields;
}
/**
 * Collect the user's phone number on the frontend campaign submission form.
 *
 * @param   array $fields
 * @param   Charitable_Ambassadors_Campaign_Form $form
 * @return  array $fields
 */
function ed_add_phone_number_field_to_campaign_submissions($fields, Charitable_Ambassadors_Campaign_Form $form)
{
    $fields['phone'] = array('label' => __('Phone Number', 'your-namespace'), 'type' => 'text', 'priority' => 53, 'required' => false, 'value' => $form->get_user_value('donor_phone'), 'data_type' => 'user');
    return $fields;
}