/** * View a customer * * @since 1.0 * * @param $customer The Customer object being displayed * * @return void */ function give_customers_view($customer) { $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); ?> <?php do_action('give_donor_card_top', $customer); ?> <div id="donor-summary" class="info-wrapper customer-section postbox"> <form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id); ?> "> <div class="customer-info"> <div class="donor-bio-header clearfix"> <div class="avatar-wrap left" id="customer-avatar"> <?php echo get_avatar($customer->email); ?> </div> <div class="customer-id" class="left"> #<?php echo $customer->id; ?> </div> <div id="customer-name-wrap" class="left"> <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?> " placeholder="<?php _e('Donor Name', 'give'); ?> " /></span> <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?> </span></span> </div> <p class="customer-since info-item"> <?php _e('Donor since', 'give'); ?> <?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)); ?> </p> <?php if (current_user_can($customer_edit_role)) { ?> <a title="<?php _e('Edit Donor', 'give'); ?> " href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e('Edit Donor', 'give'); ?> </a> <?php } ?> </div> <!-- /donor-bio-header --> <div class="customer-main-wrapper"> <table class="widefat"> <tbody> <tr> <td><label for="tablecell"><?php esc_attr_e('Email', 'give'); ?> </label></td> <td class="row-title"> <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?> " placeholder="<?php _e('Donor Email', 'give'); ?> " /></span> <span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?> </span> </td> </tr> <tr class="alternate"> <td><label for="tablecell"><?php esc_attr_e('User ID', 'give'); ?> </label></td> <td class="row-title"> <span class="customer-user-id info-item edit-item"> <?php $user_id = $customer->user_id > 0 ? $customer->user_id : ''; $data_atts = array('key' => 'user_login', 'exclude' => $user_id); $user_args = array('name' => 'customerinfo[user_login]', 'class' => 'give-user-dropdown', 'data' => $data_atts); if (!empty($user_id)) { $userdata = get_userdata($user_id); $user_args['value'] = $userdata->user_login; } echo Give()->html->ajax_user_search($user_args); ?> <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?> " /> </span> <span class="customer-user-id info-item editable"> <?php if (intval($customer->user_id) > 0) { ?> <span data-key="user_id"><?php echo $customer->user_id; ?> </span> <?php } else { ?> <span data-key="user_id"><?php _e('none', 'give'); ?> </span> <?php } ?> <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) { ?> <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e('Disconnects the current user ID from this customer record', 'give'); ?> "><?php _e('Disconnect User', 'give'); ?> </a></span> <?php } ?> </span> </td> </tr> <tr> <td><?php esc_attr_e('Address', 'give'); ?> </td> <td class="row-title"> <div class="customer-address-wrapper"> <?php if (isset($customer->user_id) && $customer->user_id > 0) { ?> <?php $address = get_user_meta($customer->user_id, '_give_user_address', true); $defaults = array('line1' => '', 'line2' => '', 'city' => '', 'state' => '', 'country' => '', 'zip' => ''); $address = wp_parse_args($address, $defaults); ?> <?php if (!empty($address)) { ?> <span class="customer-address info-item editable"> <span class="info-item" data-key="line1"><?php echo $address['line1']; ?> </span><br> <span class="info-item" data-key="line2"><?php echo $address['line2']; ?> </span><br> <span class="info-item" data-key="city">City: <?php echo $address['city']; ?> </span><br> <span class="info-item" data-key="state">State: <?php echo $address['state']; ?> </span><br> <span class="info-item" data-key="country">Country: <?php echo $address['country']; ?> </span><br> <span class="info-item" data-key="zip">Zip: <?php echo $address['zip']; ?> </span><br> </span> <?php } ?> <span class="customer-address info-item edit-item"> <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?> " value="<?php echo $address['line1']; ?> " /> <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?> " value="<?php echo $address['line2']; ?> " /> <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?> " value="<?php echo $address['city']; ?> " /> <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> <?php $selected_country = $address['country']; $countries = give_get_country_list(); foreach ($countries as $country_code => $country) { echo '<option value="' . esc_attr($country_code) . '"' . selected($country_code, $selected_country, false) . '>' . $country . '</option>'; } ?> </select> <?php $selected_state = give_get_state(); $states = give_get_states($selected_country); $selected_state = isset($address['state']) ? $address['state'] : $selected_state; if (!empty($states)) { ?> <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> <?php foreach ($states as $state_code => $state) { echo '<option value="' . $state_code . '"' . selected($state_code, $selected_state, false) . '>' . $state . '</option>'; } ?> </select> <?php } else { ?> <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e('State / Province', 'give'); ?> " /> <?php } ?> <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Postal', 'give'); ?> " value="<?php echo $address['zip']; ?> " /> </span> <?php } else { echo "none"; } ?> </div> </td> </tr> </tbody> </table> </div> </div> <span id="customer-edit-actions" class="edit-item"> <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?> " /> <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> <input type="hidden" name="give_action" value="edit-customer" /> <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?> " /> <a id="give-edit-customer-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?> </a> </span> </form> </div> <?php do_action('give_donor_before_stats', $customer); ?> <div id="customer-stats-wrapper" class="customer-section postbox clear"> <ul> <li> <a title="<?php _e('View All Purchases', 'give'); ?> " href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='******'%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); ?> </a> </li> <li> <span class="dashicons dashicons-chart-area"></span> <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php _e('Lifetime Donations', 'give'); ?> </li> <?php do_action('give_donor_stats_list', $customer); ?> </ul> </div> <?php do_action('give_donor_before_tables_wrapper', $customer); ?> <div id="customer-tables-wrapper" class="customer-section"> <?php do_action('give_donor_before_tables', $customer); ?> <h3><?php _e('Recent Donations', 'give'); ?> </h3> <?php $payment_ids = explode(',', $customer->payment_ids); $payments = give_get_payments(array('post__in' => $payment_ids)); $payments = array_slice($payments, 0, 10); ?> <table class="wp-list-table widefat striped payments"> <thead> <tr> <th><?php _e('ID', 'give'); ?> </th> <th><?php _e('Amount', 'give'); ?> </th> <th><?php _e('Date', 'give'); ?> </th> <th><?php _e('Status', 'give'); ?> </th> <th><?php _e('Actions', 'give'); ?> </th> </tr> </thead> <tbody> <?php if (!empty($payments)) { ?> <?php foreach ($payments as $payment) { ?> <tr> <td><?php echo $payment->ID; ?> </td> <td><?php echo give_payment_amount($payment->ID); ?> </td> <td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?> </td> <td><?php echo give_get_payment_status($payment, true); ?> </td> <td> <a title="<?php _e('View Details for Donation', 'give'); echo ' ' . $payment->ID; ?> " href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID); ?> "> <?php _e('View Details', 'give'); ?> </a> <?php do_action('give_donor_recent_purchases_actions', $customer, $payment); ?> </td> </tr> <?php } ?> <?php } else { ?> <tr> <td colspan="5"><?php _e('No Donations Found', 'give'); ?> </td> </tr> <?php } ?> </tbody> </table> <h3><?php _e('Completed Donations', 'give'); ?> </h3> <?php $donations = give_get_users_completed_donations($customer->email); ?> <table class="wp-list-table widefat striped downloads"> <thead> <tr> <th><?php echo give_get_forms_label_singular(); ?> </th> <th width="120px"><?php _e('Actions', 'give'); ?> </th> </tr> </thead> <tbody> <?php if (!empty($donations)) { ?> <?php foreach ($donations as $donation) { ?> <tr> <td><?php echo $donation->post_title; ?> </td> <td> <a title="<?php echo esc_attr(sprintf(__('View %s', 'give'), $donation->post_title)); ?> " href="<?php echo esc_url(admin_url('post.php?action=edit&post=' . $donation->ID)); ?> "> <?php printf(__('View %s', 'give'), give_get_forms_label_singular()); ?> </a> </td> </tr> <?php } ?> <?php } else { ?> <tr> <td colspan="2"><?php _e('No Completed Donations Found', 'give'); ?> </td> </tr> <?php } ?> </tbody> </table> <?php do_action('give_donor_after_tables', $customer); ?> </div> <?php do_action('give_donor_card_bottom', $customer); ?> <?php }
/** * Outputs the default credit card address fields * * @since 1.0 * @return void */ function give_default_cc_address_fields() { $logged_in = is_user_logged_in(); if ($logged_in) { $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); } $line1 = $logged_in && !empty($user_address['line1']) ? $user_address['line1'] : ''; $line2 = $logged_in && !empty($user_address['line2']) ? $user_address['line2'] : ''; $city = $logged_in && !empty($user_address['city']) ? $user_address['city'] : ''; $zip = $logged_in && !empty($user_address['zip']) ? $user_address['zip'] : ''; ob_start(); ?> <fieldset id="give_cc_address" class="cc-address"> <legend><?php _e('Adora art cards Receiving Details', 'give'); ?> </legend> <?php do_action('give_cc_billing_top'); ?> <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> <label for="card_address" class="give-label"> <?php _e('Address', 'give'); ?> <?php if (give_field_is_required('card_address')) { ?> <span class="give-required-indicator">*</span> <?php } ?> </label> <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address')) { echo ' required'; } ?> " placeholder="<?php _e('Address line 1', 'give'); ?> " value="<?php echo $line1; ?> " /> </p> <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> <label for="card_address_2" class="give-label"> <?php _e('Address Line 2', 'give'); ?> <?php if (give_field_is_required('card_address_2')) { ?> <span class="give-required-indicator">*</span> <?php } ?> </label> <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2')) { echo ' required'; } ?> " placeholder="<?php _e('Address line 2', 'give'); ?> " value="<?php echo $line2; ?> " /> </p> <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> <label for="card_city" class="give-label"> <?php _e('City', 'give'); ?> <?php if (give_field_is_required('card_city')) { ?> <span class="give-required-indicator">*</span> <?php } ?> </label> <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city')) { echo ' required'; } ?> " placeholder="<?php _e('City', 'give'); ?> " value="<?php echo $city; ?> " /> </p> <p id="give-card-zip-wrap" class="form-row form-row-one-third"> <label for="card_zip" class="give-label"> <?php _e('Zip / Postal Code', 'give'); ?> <?php if (give_field_is_required('card_zip')) { ?> <span class="give-required-indicator">*</span> <?php } ?> </label> <input type="text" size="4" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip')) { echo ' required'; } ?> " placeholder="<?php _e('Zip / Postal code', 'give'); ?> " value="<?php echo $zip; ?> " /> </p> <p id="give-card-country-wrap" class="form-row form-row-first"> <label for="billing_country" class="give-label"> <?php _e('Country', 'give'); ?> <?php if (give_field_is_required('billing_country')) { ?> <span class="give-required-indicator">*</span> <?php } ?> </label> <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country')) { echo ' required'; } ?> "> <?php $selected_country = give_get_country(); if ($logged_in && !empty($user_address['country']) && '*' !== $user_address['country']) { $selected_country = $user_address['country']; } $countries = give_get_country_list(); foreach ($countries as $country_code => $country) { echo '<option value="' . esc_attr($country_code) . '"' . selected($country_code, $selected_country, false) . '>' . $country . '</option>'; } ?> </select> </p> <p id="give-card-state-wrap" class="form-row form-row-last"> <label for="card_state" class="give-label"> <?php _e('State / Province', 'give'); ?> <?php if (give_field_is_required('card_state')) { ?> <span class="give-required-indicator">*</span> <?php } ?> </label> <?php $selected_state = give_get_state(); $states = give_get_states($selected_country); if ($logged_in && !empty($user_address['state'])) { $selected_state = $user_address['state']; } if (!empty($states)) { ?> <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state')) { echo ' required'; } ?> "> <?php foreach ($states as $state_code => $state) { echo '<option value="' . $state_code . '"' . selected($state_code, $selected_state, false) . '>' . $state . '</option>'; } ?> </select> <?php } else { ?> <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?> " /> <?php } ?> </p> <?php do_action('give_cc_billing_bottom'); ?> </fieldset> <?php echo ob_get_clean(); }
</strong><br /> <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?> " class="medium-text" /> </p> </div> <div class="column"> <p id="give-order-address-country-wrap"> <strong class="order-data-address-line"><?php echo _x('Country:', 'Address country', 'give'); ?> </strong><br /> <?php echo Give()->html->select(array('options' => give_get_country_list(), 'name' => 'give-payment-address[0][country]', 'selected' => $address['country'], 'show_option_all' => false, 'show_option_none' => false, 'chosen' => true, 'placeholder' => __('Select a country', 'give'))); ?> </p> <p id="give-order-address-state-wrap"> <strong class="order-data-address-line"><?php echo _x('State / Province:', 'State / province of address', 'give'); ?> </strong><br /> <?php $states = give_get_states($address['country']); if (!empty($states)) { echo Give()->html->select(array('options' => $states, 'name' => 'give-payment-address[0][state]', 'selected' => $address['state'], 'show_option_all' => false, 'show_option_none' => false, 'chosen' => true, 'placeholder' => __('Select a state', 'give'))); } else { ?> <input type="text" name="give-payment-address[0][state]" value="<?php
/** * Define General Settings Metabox and field configurations. * * Filters are provided for each settings section to allow add-ons and other plugins to add their own settings * * @param $active_tab active tab settings; null returns full array * * @return array */ public function give_settings($active_tab) { $give_settings = array('general' => array('id' => 'options_page', 'give_title' => __('General Settings', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_general', array(array('name' => __('General Settings', 'give'), 'desc' => '<hr>', 'type' => 'give_title', 'id' => 'give_title_general_settings_1'), array('name' => __('Success Page', 'give'), 'desc' => __('This is the page donators are sent to after completing their donations. The <code>[give_receipt]</code> shortcode should be on this page.', 'give'), 'id' => 'success_page', 'type' => 'select', 'options' => give_cmb2_get_post_options(array('post_type' => 'page', 'numberposts' => -1))), array('name' => __('Failed Transaction Page', 'give'), 'desc' => __('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'), 'id' => 'failure_page', 'type' => 'select', 'options' => give_cmb2_get_post_options(array('post_type' => 'page', 'numberposts' => -1))), array('name' => __('Donation History Page', 'give'), 'desc' => __('This page shows a complete donation history for the current user. The <code>[donation_history]</code> shortcode should be on this page.', 'give'), 'id' => 'history_page', 'type' => 'select', 'options' => give_cmb2_get_post_options(array('post_type' => 'page', 'numberposts' => -1))), array('name' => __('Base Country', 'give'), 'desc' => __('Where does your site operate from?', 'give'), 'id' => 'base_country', 'type' => 'select', 'options' => give_get_country_list()), array('name' => __('Currency Settings', 'give'), 'desc' => '<hr>', 'type' => 'give_title', 'id' => 'give_title_general_settings_2'), array('name' => __('Currency', 'cmb'), 'desc' => 'Choose your currency. Note that some payment gateways have currency restrictions.', 'id' => 'currency', 'type' => 'select', 'options' => give_get_currencies(), 'default' => 'USD'), array('name' => __('Currency Position', 'cmb'), 'desc' => 'Choose the position of the currency sign.', 'id' => 'currency_position', 'type' => 'select', 'options' => array('before' => __('Before - $10', 'give'), 'after' => __('After - 10$', 'give')), 'default' => 'before'), array('name' => __('Thousands Separator', 'give'), 'desc' => __('The symbol (typically , or .) to separate thousands', 'give'), 'id' => 'thousands_separator', 'type' => 'text_small', 'default' => ','), array('name' => __('Decimal Separator', 'give'), 'desc' => __('The symbol (usually , or .) to separate decimal points', 'give'), 'id' => 'decimal_separator', 'type' => 'text_small', 'default' => '.')))), 'gateways' => array('id' => 'options_page', 'give_title' => __('Payment Gateways', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_gateways', array(array('name' => __('Gateways Settings', 'give'), 'desc' => '<hr>', 'id' => 'give_title_gateway_settings_1', 'type' => 'give_title'), array('name' => __('Test Mode', 'give'), 'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), 'id' => 'test_mode', 'type' => 'checkbox'), array('name' => __('Enabled Gateways', 'give'), 'desc' => __('Choose the payment gateways you would like enabled.', 'give'), 'id' => 'gateways', 'type' => 'enabled_gateways'), array('name' => __('Default Gateway', 'give'), 'desc' => __('This is the gateway that will be selected by default.', 'give'), 'id' => 'default_gateway', 'type' => 'default_gateway'), array('name' => __('PayPal Standard', 'give'), 'desc' => '<hr>', 'type' => 'give_title', 'id' => 'give_title_gateway_settings_2'), array('name' => __('PayPal Email', 'give'), 'desc' => __('Enter your PayPal account\'s email', 'give'), 'id' => 'paypal_email', 'type' => 'text_email'), array('name' => __('PayPal Page Style', 'give'), 'desc' => __('Enter the name of the page style to use, or leave blank to use the default', 'give'), 'id' => 'paypal_page_style', 'type' => 'text'), array('name' => __('PayPal ', 'give'), 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), 'id' => 'paypal_button_type', 'type' => 'radio_inline', 'options' => array('donation' => __('Donation', 'give'), 'standard' => __('Standard Transaction', 'give')), 'default' => 'donation'), array('name' => __('Disable PayPal IPN Verification', 'give'), 'desc' => __('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'), 'id' => 'disable_paypal_verification', 'type' => 'checkbox'), array('name' => __('Offline Donations', 'give'), 'desc' => '<hr>', 'type' => 'give_title', 'id' => 'give_title_gateway_settings_3'), array('name' => __('Collect Billing Details', 'give'), 'desc' => __('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'), 'id' => 'give_offline_donation_enable_billing_fields', 'type' => 'checkbox'), array('name' => __('Offline Donation Instructions', 'give'), 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), 'id' => 'global_offline_donation_content', 'default' => give_get_default_offline_donation_content(), 'type' => 'wysiwyg', 'options' => array('textarea_rows' => 6)), array('name' => __('Offline Donation Email Instructions Subject', 'give'), 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), 'id' => 'offline_donation_subject', 'default' => __('{donation} - Offline Donation Instructions', 'give'), 'type' => 'text'), array('name' => __('Offline Donation Email Instructions', 'give'), 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), 'id' => 'global_offline_donation_email', 'default' => give_get_default_offline_donation_email_content(), 'type' => 'wysiwyg', 'options' => array('textarea_rows' => 6))))), 'display' => array('id' => 'options_page', 'give_title' => __('Display Settings', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_display', array(array('name' => __('Display Settings', 'give'), 'desc' => '<hr>', 'id' => 'give_title_display_settings_1', 'type' => 'give_title'), array('name' => __('Disable CSS', 'give'), 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), 'id' => 'disable_css', 'type' => 'checkbox'), array('name' => __('Enable Floating Labels', 'give'), 'desc' => sprintf(__('Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), 'id' => 'enable_floatlabels', 'type' => 'checkbox'), array('name' => __('Disable Welcome Screen', 'give'), 'desc' => sprintf(__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the Welcome Screen <a href="%s">here</a> if you want in the future.', 'give'), esc_url(admin_url('index.php?page=give-about'))), 'id' => 'disable_welcome', 'type' => 'checkbox'), array('name' => __('Post Types', 'give'), 'desc' => '<hr>', 'id' => 'give_title_display_settings_2', 'type' => 'give_title'), array('name' => __('Disable Form Single Views', 'give'), 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), 'id' => 'disable_forms_singular', 'type' => 'checkbox'), array('name' => __('Disable Form Archives', 'give'), 'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), 'id' => 'disable_forms_archives', 'type' => 'checkbox'), array('name' => __('Disable Form Excerpts', 'give'), 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), 'id' => 'disable_forms_excerpt', 'type' => 'checkbox'), array('name' => __('Disable Form Featured Image', 'give'), 'desc' => __('The Featured Image is an image that is chosen as the representative image for donation form. The display of this image is largely up to the theme. If you do not wish to use the featured image you can disable it using this option.', 'give'), 'id' => 'disable_form_featured_img', 'type' => 'checkbox'), array('name' => __('Disable Single Form Sidebar', 'give'), 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), 'id' => 'disable_form_sidebar', 'type' => 'checkbox'), array('name' => __('Taxonomies', 'give'), 'desc' => '<hr>', 'id' => 'give_title_display_settings_3', 'type' => 'give_title'), array('name' => __('Enable Form Categories', 'give'), 'desc' => __('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'), 'id' => 'enable_categories', 'type' => 'checkbox'), array('name' => __('Enable Form Tags', 'give'), 'desc' => __('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'), 'id' => 'enable_tags', 'type' => 'checkbox')))), 'emails' => array('id' => 'options_page', 'give_title' => __('Give Email Settings', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_emails', array(array('name' => __('Email Settings', 'give'), 'desc' => '<hr>', 'id' => 'give_title_email_settings_1', 'type' => 'give_title'), array('id' => 'email_template', 'name' => __('Email Template', 'give'), 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), 'type' => 'select', 'options' => give_get_email_templates()), array('id' => 'email_logo', 'name' => __('Logo', 'give'), 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), 'type' => 'file'), array('id' => 'from_name', 'name' => __('From Name', 'give'), 'desc' => __('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'), 'default' => get_bloginfo('name'), 'type' => 'text'), array('id' => 'from_email', 'name' => __('From Email', 'give'), 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), 'default' => get_bloginfo('admin_email'), 'type' => 'text'), array('name' => __('Donation Receipt', 'give'), 'desc' => '<hr>', 'id' => 'give_title_email_settings_2', 'type' => 'give_title'), array('id' => 'donation_subject', 'name' => __('Donation Email Subject', 'give'), 'desc' => __('Enter the subject line for the donation receipt email', 'give'), 'default' => __('Donation Receipt', 'give'), 'type' => 'text'), array('id' => 'donation_receipt', 'name' => __('Donation Receipt', 'give'), 'desc' => __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give') . '<br/>' . give_get_emails_tags_list(), 'type' => 'wysiwyg', 'default' => __("Dear", "give") . " {name},\n\n" . __("Thank you for your donation. Your generosity is appreciated! Please click on the link below to view your receipt.", "give") . "\n\n{receipt_link}\n\nSincerely,\n{sitename}"), array('name' => __('New Donation Notification', 'give'), 'desc' => '<hr>', 'id' => 'give_title_email_settings_3', 'type' => 'give_title'), array('id' => 'donation_notification_subject', 'name' => __('Donation Notification Subject', 'give'), 'desc' => __('Enter the subject line for the donation notification email', 'give'), 'type' => 'text', 'default' => __('New Donation - #{payment_id}', 'give')), array('id' => 'donation_notification', 'name' => __('Donation Notification', 'give'), 'desc' => __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give') . '<br/>' . give_get_emails_tags_list(), 'type' => 'wysiwyg', 'default' => give_get_default_donation_notification_email()), array('id' => 'admin_notice_emails', 'name' => __('Donation Notification Emails', 'give'), 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, one per line', 'give'), 'type' => 'textarea', 'default' => get_bloginfo('admin_email')), array('id' => 'disable_admin_notices', 'name' => __('Disable Admin Notifications', 'give'), 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), 'type' => 'checkbox')))), 'addons' => array('id' => 'options_page', 'give_title' => __('Give Add-ons Settings', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_addons', array())), 'licenses' => array('id' => 'options_page', 'give_title' => __('Give Licenses', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_licenses', array())), 'advanced' => array('id' => 'options_page', 'give_title' => __('Advanced Options', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_advanced', array(array('name' => __('Session Control', 'give'), 'desc' => '<hr>', 'id' => 'give_title_session_control_1', 'type' => 'give_title'), array('id' => 'session_lifetime', 'name' => __('Session Lifetime', 'give'), 'desc' => __('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in.', 'give'), 'type' => 'select', 'options' => array('86400' => __('24 Hours', 'give'), '172800' => __('48 Hours', 'give'), '259200' => __('72 Hours', 'give'), '604800' => __('1 Week', 'give'))), array('name' => __('Data Control', 'give'), 'desc' => '<hr>', 'id' => 'give_title_data_control_2', 'type' => 'give_title'), array('name' => __('Remove All Data on Uninstall?', 'give'), 'desc' => __('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'), 'id' => 'uninstall_on_delete', 'type' => 'checkbox'), array('name' => __('Filter Control', 'give'), 'desc' => '<hr>', 'id' => 'give_title_filter_control', 'type' => 'give_title'), array('name' => __('Disable <code>the_content</code> filter', 'give'), 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%s" target="_blank">Learn more</a> about the_content filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content')), 'id' => 'disable_the_content_filter', 'type' => 'checkbox'), array('name' => __('Script Loading', 'give'), 'desc' => '<hr>', 'id' => 'give_title_script_control', 'type' => 'give_title'), array('name' => __('Load Scripts in Footer?', 'give'), 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), 'id' => 'scripts_footer', 'type' => 'checkbox')))), 'api' => array('id' => 'options_page', 'give_title' => __('API', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'show_names' => false, 'fields' => apply_filters('give_settings_system', array(array('id' => 'api', 'name' => __('API', 'give'), 'type' => 'api')))), 'system_info' => array('id' => 'options_page', 'give_title' => __('System Info', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_system', array(array('id' => 'system_info', 'name' => __('System Info', 'give'), 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), 'type' => 'system_info'))))); //Return all settings array if necessary if ($active_tab === null || !isset($give_settings[$active_tab])) { return apply_filters('give_registered_settings', $give_settings); } // Add other tabs and settings fields as needed return apply_filters('give_registered_settings', $give_settings[$active_tab]); }
</label> <input name="give_address_zip" id="give_address_zip" class="text give-input" type="text" value="<?php echo esc_attr($address['zip']); ?> " /> </p> <p id="give-card-country-wrap" class="form-row form-row-first"> <label for="give_address_country"><?php _e('Country', 'give'); ?> </label> <select name="give_address_country" id="give_address_country" class="select give-select"> <?php foreach (give_get_country_list() as $key => $country) { ?> <option value="<?php echo $key; ?> "<?php selected($address['country'], $key); ?> ><?php echo esc_html($country); ?> </option> <?php } ?> </select></p>
/** * Outputs the default credit card address fields * * @since 1.0 * * @param int $form_id * * @return void */ function give_default_cc_address_fields($form_id) { $logged_in = is_user_logged_in(); if ($logged_in) { $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); } $line1 = $logged_in && !empty($user_address['line1']) ? $user_address['line1'] : ''; $line2 = $logged_in && !empty($user_address['line2']) ? $user_address['line2'] : ''; $city = $logged_in && !empty($user_address['city']) ? $user_address['city'] : ''; $zip = $logged_in && !empty($user_address['zip']) ? $user_address['zip'] : ''; ob_start(); ?> <fieldset id="give_cc_address" class="cc-address"> <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?> </legend> <?php do_action('give_cc_billing_top'); ?> <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> <label for="card_address" class="give-label"> <?php esc_html_e('Address', 'give'); ?> <?php if (give_field_is_required('card_address', $form_id)) { ?> <span class="give-required-indicator">*</span> <?php } ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The primary billing address for your credit card.', 'give'); ?> "></span> </label> <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { echo ' required'; } ?> " placeholder="<?php esc_html_e('Address line 1', 'give'); ?> " value="<?php echo $line1; ?> "<?php if (give_field_is_required('card_address', $form_id)) { echo ' required '; } ?> /> </p> <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> <label for="card_address_2" class="give-label"> <?php esc_html_e('Address Line 2', 'give'); ?> <?php if (give_field_is_required('card_address_2', $form_id)) { ?> <span class="give-required-indicator">*</span> <?php } ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?> "></span> </label> <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { echo ' required'; } ?> " placeholder="<?php esc_html_e('Address line 2', 'give'); ?> " value="<?php echo $line2; ?> "<?php if (give_field_is_required('card_address_2', $form_id)) { echo ' required '; } ?> /> </p> <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> <label for="card_city" class="give-label"> <?php esc_html_e('City', 'give'); ?> <?php if (give_field_is_required('card_city', $form_id)) { ?> <span class="give-required-indicator">*</span> <?php } ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The city for your billing address.', 'give'); ?> "></span> </label> <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { echo ' required'; } ?> " placeholder="<?php esc_html_e('City', 'give'); ?> " value="<?php echo $city; ?> "<?php if (give_field_is_required('card_city', $form_id)) { echo ' required '; } ?> /> </p> <p id="give-card-zip-wrap" class="form-row form-row-one-third"> <label for="card_zip" class="give-label"> <?php esc_html_e('Zip / Postal Code', 'give'); ?> <?php if (give_field_is_required('card_zip', $form_id)) { ?> <span class="give-required-indicator">*</span> <?php } ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The zip or postal code for your billing address.', 'give'); ?> "></span> </label> <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { echo ' required'; } ?> " placeholder="<?php esc_html_e('Zip / Postal Code', 'give'); ?> " value="<?php echo $zip; ?> " <?php if (give_field_is_required('card_zip', $form_id)) { echo ' required '; } ?> /> </p> <p id="give-card-country-wrap" class="form-row form-row-first"> <label for="billing_country" class="give-label"> <?php esc_html_e('Country', 'give'); ?> <?php if (give_field_is_required('billing_country', $form_id)) { ?> <span class="give-required-indicator">*</span> <?php } ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The country for your billing address.', 'give'); ?> "></span> </label> <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { echo ' required'; } ?> "<?php if (give_field_is_required('billing_country', $form_id)) { echo ' required '; } ?> > <?php $selected_country = give_get_country(); if ($logged_in && !empty($user_address['country']) && '*' !== $user_address['country']) { $selected_country = $user_address['country']; } $countries = give_get_country_list(); foreach ($countries as $country_code => $country) { echo '<option value="' . esc_attr($country_code) . '"' . selected($country_code, $selected_country, false) . '>' . $country . '</option>'; } ?> </select> </p> <p id="give-card-state-wrap" class="form-row form-row-last"> <label for="card_state" class="give-label"> <?php esc_html_e('State / Province', 'give'); ?> <?php if (give_field_is_required('card_state', $form_id)) { ?> <span class="give-required-indicator">*</span> <?php } ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The state or province for your billing address.', 'give'); ?> "></span> </label> <?php $selected_state = give_get_state(); $states = give_get_states($selected_country); if ($logged_in && !empty($user_address['state'])) { $selected_state = $user_address['state']; } if (!empty($states)) { ?> <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { echo ' required'; } ?> "<?php if (give_field_is_required('card_state', $form_id)) { echo ' required '; } ?> > <?php foreach ($states as $state_code => $state) { echo '<option value="' . $state_code . '"' . selected($state_code, $selected_state, false) . '>' . $state . '</option>'; } ?> </select> <?php } else { ?> <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_html_e('State / Province', 'give'); ?> "/> <?php } ?> </p> <?php do_action('give_cc_billing_bottom'); ?> </fieldset> <?php echo ob_get_clean(); }