├── .gitignore
├── README.md
├── add-on-snippets
├── authorize
│ ├── authorizenet-description-filter.php
│ └── set-sync-interval.php
├── fee-recovery
│ ├── change-breakdown-message.php
│ └── check-optin-automatically.php
├── mailchimp
│ ├── custom-merge-tags.php
│ └── give-mailchimp-optin-email-tag.php
├── pdf-receipts
│ ├── add-currency-code.php
│ ├── add-custom-tags.php
│ ├── add-ffm-tags.php
│ ├── add-gift-aid-status-to-pdf-receipt.php
│ ├── change-filename-prefix.php
│ ├── custom-link-text.php
│ ├── min-amount-for-pdf-receipt.php
│ ├── pdf-funds-receipt-tag.php
│ ├── pdf-line-break.html
│ ├── pdf-receipt-custom-background.php
│ └── pdf-receipt-custom-font.php
├── recurring-donations
│ ├── custom-recurring-checkbox-text.php
│ ├── manage-recurring-periods.php
│ ├── move-recurring-checkbox-per-form.php
│ ├── reposition-recurring-checkbox.php
│ └── set-recurring-checkbox-off.php
├── stripe
│ ├── ach-collect-billing.php
│ ├── add-tributes-meta.php
│ ├── conditional-collect-billing.php
│ └── modify-customer-description.php
├── tributes
│ ├── custom-tribute-tag.php
│ └── default-tributes-to-yes.php
└── woocommerce-upsells
│ ├── change-donation-status-to-completed-on-wc-processing.php
│ ├── customize-donation-upsell-per-product.php
│ └── exclude-products-from-upsell.php
├── admin-functions
├── add-email-to-block-list.php
├── add-give-shortcode-builder-button.php
├── add-referral-url-to-donation-meta.php
├── add-table-list-column.php
├── avatar-api-swapper.php
├── change-donor-role.php
├── change-give-featured-image-sizes.php
├── custom-currency.php
├── custom-donation-list-number.php
├── custom-minimum-donation.php
├── custom-payment-status.php
├── disable-activation-banners.php
├── disable-dashboard-donations-widget.php
├── disable-shortcode-button.php
├── display-current-url-donation-details.php
├── enable-shortcode-button-for-cpt.php
├── give-donation-submenu-show-all-status.php
├── give-helper-functions.php
├── maximum-donation-amount.php
├── modify-givewp-addons-admin-link.php
├── prevent-auto-login.php
└── remove-ip-address.php
├── conflict-resolution
└── remove-selectric.php
├── custom-shortcodes
├── donations-for-a-form-shortcode.php
├── give-total-forms.php
├── goal-achieved-form-list-shortcode.php
├── top-give-forms-shortcode.php
└── total-earnings-shortcode.php
├── customized-templates
├── add-or-reorder-donation-receipt-items.php
├── add-receipt-row.php
├── archive-give_forms.php
├── disable-receipt-row.php
└── form-grid-display-category.php
├── donors
├── add-donor-meta.php
└── customize-donor-dashboard-css.php
├── email-customization
├── class-donor-gratitude-email.php
├── conditional-email-based-on-amount.php
├── custom-email-footer-text.php
├── custom-email-headings.php
├── disable-donor-notification.php
├── magic-tag.php
├── multi-level-name-only-email-tag.php
├── register-email-template.php
└── remove-new-user-notification.php
├── form-customizations
├── add-edit-link-to-give-forms.php
├── add-html-after-multilevel.php
├── auto-focuse-on-amount.php
├── change-default-state.php
├── change-total-bar-color.php
├── close-modal-on-click.php
├── conditional-failed-donation-page.php
├── conditional-successful-donation-redirect.php
├── css-customizations
│ ├── enqueue-style-for-givewp-iframes.php
│ ├── hide-state.css
│ ├── horizontally-center-form.css
│ ├── rain-forest-demo-style.css
│ ├── style-givewp-iframes.php
│ └── styled-terms-checkbox.css
├── custom-anonymous-text.php
├── custom-countries.php
├── custom-default-featured-image.php
├── custom-donation-total-label.php
├── custom-fields-plugin.php
├── custom-offline-donation-receipt-instructions.php
├── custom-per-form-currency.php
├── custom-us-states.php
├── customize-fieldset-order.php
├── default-registration-to-yes.php
├── disable-decimals.php
├── disable-show-terms-toggle.php
├── display-accepted-cards.php
├── dont-require-fields.php
├── exclude-from-give-archive.php
├── fields-api-sample.php
├── gdpr-save-terms-to-donation-meta.php
├── give-simple-ticket-incrementer.php
├── hide-show-custom-amount.php
├── implement-recaptcha.php
├── limit-goal-to-100-percent.php
├── mailing-address-custom-fields.php
├── multilevel-recurring-text-separator.php
├── multipart-form.php
├── output-donor-wall-single-forms.php
├── populate-amount-from-url.php
├── populate-amount-name-email-from-url.php
├── rearrange-country-list.php
├── remove-goal-human-readable-format.php
├── require-last-name.php
└── validate-donation-amount.php
├── gateway-customizations
├── add-billing-fields-to-offline-donations.php
├── add-custom-field-to-braintree-payment.php
├── add-custom-gateways.php
├── authorizenet-custom-invoice-prefix.php
├── authorizenet-phonenumber-from-custom-field.php
├── ccavenue-per-form-accounts.php
├── disable-gateway-on-frontend.php
├── offline-auto-complete.php
├── offline-donations-customize-emails.php
├── paypal
│ ├── paypal-custom-checkout-locale.php
│ ├── paypal-custom-success-page-redirects.php
│ ├── paypal-payflow-customize-comments.php
│ ├── paypal-standard-custom-cancel-redirect.php
│ └── paypal-standard-mutliple-accounts.php
├── stripe-pass-custom-meta-for-customers.php
└── stripe-pass-custom-meta-for-payments.php
├── theme-compatibility
├── avada-compatibility.md
├── conditional-script-loading.php
├── custom-wrapper-start-end.php
├── eduma-compatibility.md
├── impreza-modal-fixes.css
├── kadencewp-theme.php
├── remove-give-version-meta-tag.php
└── unselectize-give.php
├── translation-snippets
├── advanced-translation-snippet.php
├── change-all-instances-donation.php
├── change-offline-donation-payment-heading.php
├── change-text-locally-per-form.php
├── custom-fee-recovery-breakdown-language.php
├── givewp-weblog-integration.php
├── personalize-tooltips.php
├── recurring-donor-choice-translation.php
├── recurring-message-linked.php
└── simple-translation-snippet.php
└── useful-queries
├── better-donor-list-shortcode.php
├── list-donation-forms-plus-goals.php
├── recent-donors-shortcode.php
└── sample-transaction-queries.php
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Give Snippet Library
2 |
3 | A collection of code snippets to enhance or expand on the free Give WordPress Donation Plugin. Be sure to customize the function names or wrap with `function_exists` contionals to avoid collisions.
4 |
5 | If you need assistance implementing custom PHP code on your WordPress website, we have this guide:
6 |
7 | https://givewp.com/documentation/resources/adding-custom-functions-to-your-wordpress-website/
8 |
9 | For custom CSS see this guide:
10 | https://givewp.com/documentation/resources/handling-custom-css-in-wordpress/
11 |
12 | Please note that these code snippets are provided as examples of how you can extend Give with code. It’s up to you to implement and customize to your liking. We cannot provide support for custom code, even code derived from these snippets, on your website.
13 |
14 | We review and accept PRs. Have something the Give community could benefit from? Submit a PR today!
15 |
--------------------------------------------------------------------------------
/add-on-snippets/authorize/authorizenet-description-filter.php:
--------------------------------------------------------------------------------
1 | Tools -> Logs
14 | * \Give\Framework\PaymentGateways\Log\PaymentGatewayLog::success('Contents of the variables',
15 | * [
16 | * 'Purchase Data' => $purchase_data,
17 | * 'Subscription' => $subscription,
18 | * ]
19 | * );
20 | **/
21 |
22 | $description .= ' - '. $purchase_data['post_data']['give-form-title'];
23 |
24 | return $description;
25 | },
26 | 999,
27 | 3
28 | );
29 |
30 | // Use this function to filter the Authorize.net payment description on one-time donations
31 | add_filter(
32 | 'give_authorize_one_time_payment_description',
33 | function($description, $purchase_data){
34 |
35 | /** Uncomment this block to get the $purchase_data array listed in Donations -> Tools -> Logs
36 | * \Give\Framework\PaymentGateways\Log\PaymentGatewayLog::success('Contents of the variables',
37 | * [
38 | * 'Purchase Data' => $purchase_data,
39 | * ]
40 | * );
41 | **/
42 |
43 | $description .= ' - '. $purchase_data['post_data']['give-form-title'];
44 |
45 | return $description;
46 | },
47 | 999,
48 | 2
49 | );
--------------------------------------------------------------------------------
/add-on-snippets/authorize/set-sync-interval.php:
--------------------------------------------------------------------------------
1 |
6 |
11 |
12 | $_POST['my_ffm_field'], // 'my_ffm_field' is the FFM Meta Key.
10 | );
11 |
12 | // Add custom tags to default merge tags (FNAME, LNAME).
13 | $api_args['merge_vars'] = array_merge( $custom_merge_vars, $api_args['merge_vars'] );
14 |
15 | return $api_args;
16 |
17 | }
18 |
19 | add_filter( 'give_mc_subscribe_vars', 'my_give_mailchimp_merge_vars' );
20 |
--------------------------------------------------------------------------------
/add-on-snippets/mailchimp/give-mailchimp-optin-email-tag.php:
--------------------------------------------------------------------------------
1 | 'give_mailchimp_status', // The tag name.
13 | 'desc' => __( 'This outputs whether the donor opted-in to the Newsletter', 'give-mailchimp' ), // For admins.
14 | 'func' => 'give_mailchimp_optin_email_tag_function', // Callback to function below.
15 | 'context' => 'general', // This tag can be for both admin and donor notifications.
16 | 'is_admin' => false, // default is false. This is here to simply display it as an option.
17 | )
18 | );
19 | }
20 |
21 | add_action( 'give_add_email_tags', 'add_give_mailchimp_optin_email_tag' );
22 |
23 | /**
24 | * Return email tag content
25 | *
26 | * Gets the data from the meta to display in the tag. Sets a default fallback message
27 | *
28 | * @param array $tag_args Array of arguments
29 | *
30 | * @return string
31 | */
32 | function give_mailchimp_optin_email_tag_function( $tag_args ) {
33 |
34 |
35 | $opt_in_meta = give_get_meta( $tag_args['payment_id'], '_give_mc_donation_optin_status', true );
36 |
37 | $output = __( 'Not opted-in :(', 'give-mailchimp' ); // Fallback message. (optional)
38 |
39 | if ( ! empty( $opt_in_meta ) ) {
40 | $output = 'Opted-in';
41 | }
42 |
43 | return $output;
44 | }
45 |
--------------------------------------------------------------------------------
/add-on-snippets/pdf-receipts/add-currency-code.php:
--------------------------------------------------------------------------------
1 | ".print_r($args,true)."");
12 | if ( ! empty( $args['payment_meta']['_give_payment_currency'] ) ) {
13 | $template_content = str_replace( '{abbr}', $args['payment_meta']['_give_payment_currency'], $template_content );
14 | }
15 | return $template_content;
16 | }
17 |
18 | add_filter( 'give_pdf_compiled_template_content', 'give_add_currency_pdf_tag', 999, 2 );
--------------------------------------------------------------------------------
/add-on-snippets/pdf-receipts/add-custom-tags.php:
--------------------------------------------------------------------------------
1 | ".print_r($args,true)."");
18 |
19 | $total = isset( $args['payment_meta']['_give_payment_total'] ) ? html_entity_decode( give_currency_filter( give_format_amount( $args['payment_meta']['_give_payment_total'] ) ), ENT_COMPAT, 'UTF-8' ) : '';
20 | $template_content = str_replace( '{total}', $total, $template_content );
21 | return $template_content;
22 | }
23 |
24 | add_filter( 'give_pdf_compiled_template_content', 'give_add_total_pdf_tag', 999, 2 );
25 |
--------------------------------------------------------------------------------
/add-on-snippets/pdf-receipts/add-ffm-tags.php:
--------------------------------------------------------------------------------
1 | ".print_r($args,true)."");
20 |
21 | $total = isset( $args['payment_meta']['REPLACE WITH FFM META'] ) ? html_entity_decode( $args['payment_meta']['REPLACE WITH FFM META'], ENT_COMPAT, 'UTF-8' ) : '';
22 | $template_content = str_replace( '{LABEL}', $total, $template_content );
23 | return $template_content;
24 | }
25 |
26 | add_filter( 'give_pdf_compiled_template_content', 'give_add_LABEL_pdf_tag', 999, 2 );
27 |
28 |
--------------------------------------------------------------------------------
/add-on-snippets/pdf-receipts/add-gift-aid-status-to-pdf-receipt.php:
--------------------------------------------------------------------------------
1 |
34 |
35 |
36 |
37 |
38 |
39 | getFormAssociatedFunds( give_get_payment_form_id( $args['donation_id'] ) );
30 |
31 | /* @var Fund $fund */
32 | $fund = $formAssociatedFunds[0];
33 | $template_content = str_replace( '{funds}', $fund->getTitle(), $template_content );
34 |
35 | return $template_content;
36 | }
37 |
38 | add_filter( 'give_pdf_compiled_template_content', 'give_add_total_pdf_tag', 999, 2 );
39 |
--------------------------------------------------------------------------------
/add-on-snippets/pdf-receipts/pdf-line-break.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PDF Line Break
6 |
7 |
8 |
9 | If Admin wants to add line break on PDF then they have to add below HTML Code after complete
tag.
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
Place HTML snippet where you want to line break in PDF.
21 |
22 |
23 |
24 |
25 |
Output: Line break added
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/add-on-snippets/pdf-receipts/pdf-receipt-custom-background.php:
--------------------------------------------------------------------------------
1 |
16 |
17 |
58 |
59 | payment_meta->get_meta( $donation_id, '_give_tributes_type', true );
14 | $tribute_first_name = Give()->payment_meta->get_meta( $donation_id, '_give_tributes_first_name', true );
15 | $tribute_last_name = Give()->payment_meta->get_meta( $donation_id, '_give_tributes_last_name', true );
16 |
17 | $custom_meta_fields = array(
18 | $tribute_text => "{$tribute_first_name} {$tribute_last_name}",
19 | );
20 |
21 | $charge_args['metadata'] = array_merge( $charge_args['metadata'], $custom_meta_fields );
22 |
23 | return $charge_args;
24 | }
25 |
26 | add_filter( 'give_stripe_create_charge_args', 'give_stripe_custom_payment_meta', 10, 2 );
27 |
--------------------------------------------------------------------------------
/add-on-snippets/stripe/conditional-collect-billing.php:
--------------------------------------------------------------------------------
1 | 'member_names',
15 | 'description' => __( 'Names of members sponsoring this Mass.', 'give-tributes' ),
16 | 'function' => 'give_tribute_member_names_card',
17 | )
18 | );
19 | return array_merge( $tribute_tags, $new_tribute_tag );
20 | }
21 |
22 |
23 | function give_tribute_member_names_card( $payment_id ) {
24 |
25 | $payment = new Give_Payment( $payment_id );
26 | $payment_meta = $payment->payment_meta;
27 |
28 | $member_names = $payment_meta['member_names'];
29 |
30 | $output = __( 'No referral data found.', 'give-tributes' );
31 |
32 | if ( ! empty( $member_names ) ) {
33 | $output = $member_names;
34 | }
35 | return $output;
36 | }
37 |
--------------------------------------------------------------------------------
/add-on-snippets/tributes/default-tributes-to-yes.php:
--------------------------------------------------------------------------------
1 |
20 |
24 |
25 | get_status();
20 |
21 | if ( 'processing' === $wc_original_status ) {
22 | $wc_order_status = 'completed';
23 | }
24 |
25 | return $wc_order_status;
26 | }
27 |
--------------------------------------------------------------------------------
/add-on-snippets/woocommerce-upsells/customize-donation-upsell-per-product.php:
--------------------------------------------------------------------------------
1 | cart->get_cart() as $cart_item ) {
19 | $cart_products_ids_array[] = $cart_item['product_id'];
20 | }
21 |
22 | // Setting this to false for the conditions below.
23 | // NOTE: Depending on your use case this may not be needed.
24 | // $is_enabled = false;
25 |
26 | /**
27 | * Uncomment an example below or create your own conditions.
28 | */
29 |
30 | // Example 1: Only display upsell if a single product is contained within the cart. The customer can have other products, but this one needs to be in the cart for the upsell to display.
31 | // if ( in_array( 692, $cart_products_ids_array ) ) {
32 | // $is_enabled = true;
33 | // }
34 |
35 | // Example 2: Only display upsell if ONLY the single product is in the cart.
36 | // if( in_array( 692, $cart_products_ids_array ) && 2 === count($cart_products_ids_array) ) {
37 | // $is_enabled = true;
38 | // }
39 |
40 | // Always return $is_enabled as boolean.
41 | return $is_enabled;
42 |
43 | }
44 |
45 | add_action( 'give_wc_should_donation_upsell_display', 'give_woo_show_donation_for_specific_products', 10, 3 );
--------------------------------------------------------------------------------
/add-on-snippets/woocommerce-upsells/exclude-products-from-upsell.php:
--------------------------------------------------------------------------------
1 | cart->get_cart() as $cart_item ) {
20 | $cart_products_ids_array[] = $cart_item['product_id'];
21 | }
22 |
23 | // Product IDs that should exclude the upsell
24 | $products = array(123, 456);
25 |
26 | if ( in_array( $products, $cart_products_ids_array ) ) {
27 | $is_enabled = false;
28 | }
29 |
30 | return $is_enabled;
31 | }
32 |
33 | add_action( 'give_wc_should_donation_upsell_display', 'give_woo_exclude_upsell_for_specific_products', 10, 3 );
34 |
--------------------------------------------------------------------------------
/admin-functions/add-email-to-block-list.php:
--------------------------------------------------------------------------------
1 | get_meta();
11 | $referral_url = esc_url($payment_meta['_give_current_url']);
12 |
13 | if ( $referral_url ) : ?>
14 |
15 |
19 |
20 | id
24 | );
25 | }
26 | }
27 |
28 | function givewp_register_list_table_columns($list_table) {
29 | /*
30 | * Notes:
31 | * ->addColumnBefore('status', new MyCustomColumn()) will add the custom column before a specific one
32 | * ->addColumn(new MyCustomColumn()) will just add the custom column after all others
33 | * ->addColumnAfter('id'' new MyCustomColun()) will add the custom after a specific one
34 | *
35 | * setColumnVisibility method can be ommited in case the custom column doesn't need to be visible at load
36 | */
37 | $list_table
38 | ->addColumnBefore('status', new MyCustomColumn())
39 | ->setColumnVisibility(MyCustomColumn::getId(), true);
40 |
41 | return $list_table;
42 | }
43 | /*
44 | * Available hooks:
45 | * givewp_donation_forms_list_table
46 | * givewp_donations_list_table
47 | * givewp_donors_list_table
48 | * givewp_subscriptions_list_table
49 | */
50 | add_filter('givewp_donations_list_table', 'givewp_register_list_table_columns');
51 |
--------------------------------------------------------------------------------
/admin-functions/avatar-api-swapper.php:
--------------------------------------------------------------------------------
1 | ';
15 |
16 | return $avatar;
17 | }
18 |
--------------------------------------------------------------------------------
/admin-functions/change-donor-role.php:
--------------------------------------------------------------------------------
1 | '400',
17 | 'height' => '400',
18 | 'crop' => 1
19 | );
20 |
21 | return $size;
22 |
23 | }
--------------------------------------------------------------------------------
/admin-functions/custom-currency.php:
--------------------------------------------------------------------------------
1 | __( 'Vietnamese đồng (₫)', 'give' ),
34 | 'symbol' => '₫',
35 | 'setting' => array(
36 | 'currency_position' => 'after',
37 | 'thousands_separator' => '.',
38 | 'decimal_separator' => ',',
39 | 'number_decimals' => 2,
40 | ),
41 | );
42 |
43 | return $currencies;
44 | }
45 |
46 | add_filter( 'give_register_currency', 'my_give_add_costarican_currency', 10, 1 );
47 |
--------------------------------------------------------------------------------
/admin-functions/custom-donation-list-number.php:
--------------------------------------------------------------------------------
1 | 50, // Default is 30
15 | );
16 |
17 | return array_merge( $args, $updated_args );
18 | }
19 |
--------------------------------------------------------------------------------
/admin-functions/custom-minimum-donation.php:
--------------------------------------------------------------------------------
1 | __( 'Under Review', 'give' ),
23 | 'public' => true,
24 | 'exclude_from_search' => false,
25 | 'show_in_admin_all_list' => true,
26 | 'show_in_admin_status_list' => true,
27 | 'label_count' => _n_noop( 'Under Review (%s) ', 'Under Review (%s) ', 'give' ),
28 | ) );
29 |
30 | register_post_status( 'pending_approval', array(
31 | 'label' => __( 'Pending Approval', 'give' ),
32 | 'public' => true,
33 | 'exclude_from_search' => false,
34 | 'show_in_admin_all_list' => true,
35 | 'show_in_admin_status_list' => true,
36 | 'label_count' => _n_noop( 'Pending Approval (%s) ', 'Pending Approval (%s) ', 'give' ),
37 | ) );
38 |
39 | }
40 |
41 | add_action( 'wp_loaded', 'my_give_register_post_statuses' );
42 |
43 |
44 | /**
45 | * Register Custom Statuses for Give to interpret.
46 | *
47 | * Tells Give about our new payment status.
48 | *
49 | * @since 1.0
50 | * @access public
51 | *
52 | * @param $stati
53 | *
54 | * @return array
55 | */
56 | function my_give_register_custom_statuses( $stati ) {
57 | $stati['under_review'] = __( 'Under Review', 'give' );
58 | $stati['pending_approval'] = __( 'Pending Approval', 'give' );
59 |
60 | return $stati;
61 | }
62 |
63 | add_filter( 'give_payment_statuses', 'my_give_register_custom_statuses' );
64 |
65 |
66 | /**
67 | * Add filter options under to the Give donations table.
68 | *
69 | * @param $views
70 | *
71 | * @return mixed
72 | */
73 | function my_give_add_custom_tableview( $views ) {
74 |
75 | $current = isset( $_GET['status'] ) ? $_GET['status'] : '';
76 | $payment_count = wp_count_posts( 'give_payment' );
77 | $empty = ' (0) ';
78 | $under_review_count = isset( $payment_count->under_review ) ? ' (' . $payment_count->under_review . ') ' : $empty;
79 | $pending_approval_count = isset( $payment_count->pending_approval ) ? ' (' . $payment_count->pending_approval . ') ' : $empty;
80 |
81 | $views['under_review'] = sprintf( '%s ', esc_url( add_query_arg( array(
82 | 'status' => 'under_review',
83 | 'paged' => false,
84 | ) ) ), $current === 'under_review' ? ' class="current"' : '', esc_html__( 'Under Review', 'give' ) . $under_review_count );
85 |
86 | $views['pending_approval'] = sprintf( '%s ', esc_url( add_query_arg( array(
87 | 'status' => 'pending_approval',
88 | 'paged' => false,
89 | ) ) ), $current === 'pending_approval' ? ' class="current"' : '', esc_html__( 'Pending Approval', 'give' ) . $pending_approval_count );
90 |
91 | return $views;
92 | }
93 |
94 | add_filter( 'give_payments_table_views', 'my_give_add_custom_tableview' );
95 |
96 |
97 | /**
98 | * Adds bulk options to select dropdown.
99 | *
100 | * @param array $actions
101 | *
102 | * @return array $actions
103 | */
104 | function my_give_add_custom_payment_bulk_actions( $actions ) {
105 |
106 | $actions['set-status-under-review'] = __( 'Set To Under Review', 'give' );
107 | $actions['set-status-pending-approval'] = __( 'Set To Pending Approval', 'give' );
108 |
109 | return $actions;
110 | }
111 |
112 | add_filter( 'give_payments_table_bulk_actions', 'my_give_add_custom_payment_bulk_actions', 10, 1 );
113 |
114 |
115 | /**
116 | * Processes the bulk actions.
117 | *
118 | * @param $id
119 | * @param $current_action
120 | */
121 | function my_give_process_custom_bulk_action( $id, $current_action ) {
122 |
123 | switch ( $current_action ) {
124 | case 'set-status-under-review':
125 | give_update_payment_status( $id, 'under_review' );
126 | break;
127 | case 'set-status-pending-approval':
128 | give_update_payment_status( $id, 'pending_approval' );
129 | break;
130 | }
131 |
132 | }
133 |
134 |
135 | add_filter( 'give_payments_table_do_bulk_action', 'my_give_process_custom_bulk_action', 10, 2 );
--------------------------------------------------------------------------------
/admin-functions/disable-activation-banners.php:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 | URL of Donation Submission:
16 |
17 |
18 |
19 | Settings > Advanced > Clear old license. Then deactivate and unistall this plugin.
6 | * Author: BenUNC
7 | *
8 | *
9 | */
10 |
11 |
12 | // Exit if accessed directly.
13 | if ( ! defined( 'ABSPATH' ) ) {
14 | exit;
15 | }
16 |
17 | function my_give_delete_old_licenses() {
18 |
19 | foreach ( give_get_settings() as $option => $value ) {
20 | if ( stripos( strrev( $option ), strrev( '_license_key' ) ) === 0 ) {
21 | give_delete_option( $option );
22 | }
23 | }
24 | foreach ( wp_load_alloptions() as $option => $value ) {
25 | if ( strpos( $option, 'give_' ) === 0 && stripos( strrev( $option ), strrev( '_license_active' ) ) === 0 ) {
26 | delete_option( $option );
27 | }
28 | }
29 | }
30 |
31 | add_filter( 'give_get_sections_advanced', 'my_give_license_clear_section' );
32 |
33 | function my_give_license_clear_section( $section ) {
34 | $section['license-fix'] = __( 'Clear old license', 'give' );
35 |
36 | return $section;
37 | }
38 |
39 | function my_give_license_add_advanced_settings( $settings ) {
40 |
41 | $current_section = give_get_current_setting_section();
42 |
43 | if ( 'license-fix' !== $current_section ) {
44 | return $settings;
45 | }
46 | my_give_delete_old_licenses();
47 | echo "All Set! Things should work now. Navigate To the Licenses tab above and re-enter your licenses ";
48 |
49 | return $settings;
50 |
51 | }
52 |
53 | add_filter( 'give_get_settings_advanced', 'my_give_license_add_advanced_settings', 10, 1 );
54 |
--------------------------------------------------------------------------------
/admin-functions/maximum-donation-amount.php:
--------------------------------------------------------------------------------
1 | $max_amount ) {
16 | give_set_error( 'max_donation_amount', sprintf( __( 'The donation amount must be %s or less. Please select a specified amount or enter a lower custom donation amount.', 'give' ), give_currency_filter( give_format_amount( $max_amount ) ) ) );
17 | }
18 |
19 | return $valid_data;
20 |
21 | }
22 |
23 | add_action( 'give_checkout_error_checks', 'give_custom_max_donation_amount', 10, 2 );
24 |
--------------------------------------------------------------------------------
/admin-functions/modify-givewp-addons-admin-link.php:
--------------------------------------------------------------------------------
1 |
16 |
27 |
28 |
34 |
45 |
46 | false,
22 | ), $atts, 'give_raised_for_forms' );
23 |
24 | $formId = $atts[ 'form_id' ];
25 |
26 | if ( ! $formId ) {
27 | $message = 'It\'s necessary that you insert the form ID on the shortcode.';
28 | } elseif ( get_post_type( $formId ) !== 'give_forms' ) {
29 | $message = 'This is not a donation form. Make sure you are using an ID for a donation form.';
30 | } else {
31 | $form_title = get_the_title( $formId );
32 | $number_of_donations = give_get_meta( $formId, '_give_form_sales', true );
33 |
34 | $message = sprintf(
35 | 'We already have %s donations for the %s campaign!',
36 | $number_of_donations,
37 | $form_title
38 | );
39 | }
40 |
41 | return '';
42 |
43 | }
44 | add_shortcode( 'give_raised_for_forms', 'my_give_display_donations_for_forms');
45 |
--------------------------------------------------------------------------------
/custom-shortcodes/give-total-forms.php:
--------------------------------------------------------------------------------
1 | publish;
14 |
15 | $atts = shortcode_atts( array(
16 | 'donation_forms_page_id' => false,
17 | ), $atts, 'give_total_forms' );
18 |
19 | $donation_forms_page = '';
20 |
21 | if ( $atts['donation_forms_page_id']) {
22 | $link = get_permalink($atts['donation_forms_page_id']);
23 |
24 | $donation_forms_page = ' Check out our campaigns! ';
25 | }
26 |
27 | $html = '
28 |
33 | ';
34 |
35 | return $html;
36 |
37 | }
38 | add_shortcode( 'give_total_forms', 'my_give_display_number_of_forms');
39 |
--------------------------------------------------------------------------------
/custom-shortcodes/goal-achieved-form-list-shortcode.php:
--------------------------------------------------------------------------------
1 | 'give_forms',
11 | 'post_status' => 'publish',
12 | 'posts_per_page' => get_option( 'posts_per_page' ),
13 | 'orderby' => 'date',
14 | 'order' => 'ASC',
15 | 'meta_key' => '_give_goal_option',
16 | 'meta_value' => 'enabled',
17 | );
18 |
19 | // Query to output donation forms.
20 | $form_query = new WP_Query( $form_args );
21 |
22 | if ( $form_query->have_posts() ) {
23 | ob_start();
24 |
25 | printf( ' Form ID Form Name ' );
26 |
27 | while ( $form_query->have_posts() ) {
28 |
29 | $form_query->the_post();
30 |
31 | $goal_stats = give_goal_progress_stats( get_the_ID() );
32 |
33 | // Skip printing the form if the goal is not achieved.
34 | if ( $goal_stats['raw_actual'] < $goal_stats['raw_goal'] ) {
35 | continue;
36 | }
37 |
38 | // Print Form ID and Form Title with hyperink.
39 | printf(
40 | '%1$s %3$s ',
41 | get_the_ID(),
42 | get_the_permalink(),
43 | get_the_title()
44 | );
45 | }
46 |
47 | printf( '
' );
48 |
49 | wp_reset_postdata();
50 |
51 | return ob_get_clean();
52 | }
53 | }
54 |
55 | add_shortcode( 'give_goal_achieved_forms', 'give_render_goal_achieved_forms_list' );
56 |
--------------------------------------------------------------------------------
/custom-shortcodes/top-give-forms-shortcode.php:
--------------------------------------------------------------------------------
1 | 3,
14 | 'order' => 'DESC',
15 | 'decimals' => false
16 | ), $atts, 'top_give_forms' );
17 |
18 | $args = array(
19 | 'post_type' => 'give_forms',
20 | 'posts_per_page' => $atts['limit'],
21 | 'meta_key' => '_give_form_earnings',
22 | 'orderby' => 'meta_value_num',
23 | 'order' => $atts['order'],
24 | );
25 |
26 | $wp_query = new WP_Query( $args );
27 |
28 | if ( $wp_query->have_posts() ) :
29 |
30 | ob_start();
31 | ?>
32 |
33 |
63 |
64 | '10,000',
24 | 'link' => false,
25 | 'form_id' => false,
26 | 'multi_id' => '',
27 | 'message_before' => 'So far, we have raised ',
28 | 'message_between' => ' toward our goal of ',
29 | 'message_after' => '! ',
30 | 'link_text' => 'Donate Now'
31 | ), $atts, 'givetotal' );
32 |
33 | $donate_link = '';
34 |
35 | if ( $atts['link'] != false ) {
36 | $donate_link = ' ' . $atts['link_text'] . ' ';
37 | }
38 |
39 | if ( $atts['form_id'] != false && is_numeric( $atts['form_id'] ) ) {
40 | $total = get_post_meta( $atts['form_id'], '_give_form_earnings', true );
41 | }
42 |
43 | if ( $atts['multi_id'] != false ) {
44 | $total = 0;
45 | $new_array = preg_split("/,/", $atts['multi_id']);
46 |
47 | foreach ($new_array as $value ) {
48 | $total += get_post_meta( $value, '_give_form_earnings', true );
49 | }
50 | }
51 |
52 | $custom_nag = "" . $atts['message_before'] . "" . give_currency_symbol( give_get_currency()) . " " . give_format_amount( $total ) . " " . $atts['message_between'] . "" . give_currency_symbol( give_get_currency()) . " " . $atts['total_goal'] . " " . $atts['message_after'] . $donate_link . "
";
53 |
54 | return $custom_nag;
55 |
56 | }
57 | add_shortcode( 'givetotal', 'my_give_display_earnings_shortcode');
58 |
--------------------------------------------------------------------------------
/customized-templates/add-or-reorder-donation-receipt-items.php:
--------------------------------------------------------------------------------
1 | __( 'Label', 'give' ),
31 | 'value' => 'any custom value',
32 | 'display' => true,// true or false | whether you need to display the new item in donation receipt or not.
33 | );
34 |
35 | return $updated_args;
36 |
37 | }
38 |
39 | add_filter( 'give_donation_receipt_args', 'my_give_reorder_donation_receipt_items', 30, 3 );
40 |
--------------------------------------------------------------------------------
/customized-templates/add-receipt-row.php:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
21 |
22 |
16 |
17 |
18 |
19 | 'give_forms',
25 | 'posts_per_page' => 10,
26 | );
27 |
28 | $wp_query = new WP_Query( $args );
29 |
30 | if ( $wp_query->have_posts() ) : ?>
31 |
32 | All The Ways You Can Support Us
33 |
34 |
35 | have_posts() ) : $wp_query->the_post();?>
39 | ';
58 | }
59 |
60 | // Output the goal
61 | $goal_option = get_post_meta( $id, '_give_goal_option', true );
62 | if ( $goal_option == 'yes' ) {
63 | $shortcode = '[give_goal id="' . $id . '"]';
64 | echo do_shortcode( $shortcode );
65 | }
66 |
67 |
68 | // Output a link to take users to the form
69 | ?>
70 |
71 |
72 |
73 |
79 |
80 | Sorry, no donation forms found.
81 |
82 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/customized-templates/disable-receipt-row.php:
--------------------------------------------------------------------------------
1 | false,
14 | );
15 | return array_merge($args, $updated_args);
16 | }
17 |
18 | add_filter( 'give_donation_receipt_args', 'my_give_custom_receipt_items', 30, 3 );
19 |
--------------------------------------------------------------------------------
/customized-templates/form-grid-display-category.php:
--------------------------------------------------------------------------------
1 | "all") );
22 | ?>
23 |
24 |
25 | ',
30 | esc_attr( $form_id ),
31 | esc_attr( get_the_permalink() )
32 | );
33 | } elseif ( 'modal_reveal' === $atts['display_style'] ) {
34 | printf(
35 | '
',
36 | esc_attr( $form_id )
37 | );
38 | }
39 | ?>
40 |
41 |
42 | ' . $cats[0]->name . '';
47 | }
48 |
49 | // Maybe display the form title.
50 | if ( true === $atts['show_title'] ) {
51 | the_title( '
', ' ' );
52 | }
53 |
54 | // Maybe display the form excerpt.
55 | if ( true === $atts['show_excerpt'] ) {
56 | if ( has_excerpt( $form_id ) ) {
57 | // Get excerpt from the form post's excerpt field.
58 | $raw_content = get_the_excerpt( $form_id );
59 | $stripped_content = wp_strip_all_tags(
60 | strip_shortcodes( $raw_content )
61 | );
62 | } else {
63 | // Get content from the form post's content field.
64 | $raw_content = give_get_meta( $form_id, '_give_form_content', true );
65 |
66 | if ( ! empty( $raw_content ) ) {
67 | $stripped_content = wp_strip_all_tags(
68 | strip_shortcodes( $raw_content )
69 | );
70 | }
71 | }
72 |
73 | // Maybe truncate excerpt.
74 | if ( 0 < $atts['excerpt_length'] ) {
75 | $excerpt = wp_trim_words( $stripped_content, $atts['excerpt_length'] );
76 | } else {
77 | $excerpt = $stripped_content;
78 | }
79 |
80 | printf( '
%s
', $excerpt );
81 | }
82 |
83 | // Maybe display the goal progess bar.
84 | if (
85 | give_is_setting_enabled( get_post_meta( $form_id, '_give_goal_option', true ) )
86 | && true === $atts['show_goal']
87 | ) {
88 | echo '
';
89 | give_show_goal_progress( $form_id );
90 | echo '
';
91 | }
92 | ?>
93 |
94 |
95 | ';
112 | if ( 'auto' !== $atts['image_height'] ) {
113 | $image_attr = array(
114 | 'style' => 'height: ' . $atts['image_height'],
115 | );
116 | }
117 | the_post_thumbnail( $image_size, $image_attr );
118 | echo ' ';
119 | }
120 | ?>
121 |
122 | ',
127 | $form_id
128 | );
129 | give_get_donation_form( $form_id );
130 | echo '';
131 | }
132 | ?>
133 |
134 |
--------------------------------------------------------------------------------
/donors/add-donor-meta.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 | *
9 |
10 | tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?>
11 |
12 |
13 |
24 |
25 |
26 | 'invalid_phone',
42 | 'error_message' => __( 'Please enter phone number.', 'give' ),
43 | );
44 |
45 | return $required_fields;
46 | }
47 | add_action( 'give_donation_form_required_fields', 'give_required_donor_phone_form_field', 10, 2 );
48 |
49 | /**
50 | * Save phone number to donation and donor meta
51 | * Note: donor phone will update in donor meta if donor changes the phone number.
52 | * So on a second donation with a new number, the old number will be changed in the DONOR meta,
53 | * but the donation meta of the first donation will have the old number.
54 | *
55 | * @param int $donation_id Donation ID.
56 | */
57 | function give_save_donor_phone_number( $donation_id ){
58 |
59 | $donor_id = give_get_payment_donor_id( $donation_id );
60 | $new_phone_number = give_clean( $_POST['give_phone'] );
61 | $phone_numbers = Give()->donor_meta->get_meta( $donor_id, 'give_phone' );
62 |
63 | // Add phone number to donor meta only if not exist.
64 | if ( ! in_array( $new_phone_number, $phone_numbers, true ) ) {
65 | Give()->donor_meta->add_meta( $donor_id, 'give_phone', $new_phone_number );
66 | }
67 |
68 | // Save phone number to donation meta.
69 | Give()->payment_meta->update_meta( $donation_id, '_give_phone', $new_phone_number );
70 | }
71 | add_action( 'give_insert_payment', 'give_save_donor_phone_number', 10 );
72 |
73 | /**
74 | * Show donor phone numbers on donor profile
75 | *
76 | * @param Give_Donor $donor Donor Object.
77 | */
78 | function give_show_donor_phone_numbers( $donor ) {
79 | $phone_numbers = $donor->get_meta( 'give_phone', false );
80 | ?>
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | donor_meta->get_meta( $donor->id, 'give_phone', true );
126 | $data['phone_number'] = ! empty( $phone_number ) ? $phone_number : '- N/A - ';
127 |
128 | return $data;
129 | }
130 | add_filter( 'give_export_set_donor_data', 'give_export_set_custom_donor_data', 10, 2 );
131 |
--------------------------------------------------------------------------------
/donors/customize-donor-dashboard-css.php:
--------------------------------------------------------------------------------
1 |
11 |
68 | payment = new Give_Payment( 0 );
34 |
35 | $this->load( array(
36 | 'id' => 'donor-gratitude',
37 | 'label' => __( 'Donor Gratitude', 'give' ),
38 | 'description' => __( 'Donor Gratitude will be sent to admin when donor donation amount greater then certain amount.', 'give' ),
39 | 'has_recipient_field' => false,
40 | 'notification_status' => 'disabled',
41 | 'default_email_subject' => __( '{name} you made my day!', 'give' ),
42 | 'default_email_message' => $this->get_default_email_message(),
43 | ) );
44 |
45 | add_action( 'give_new-donation_email_notification', array( $this, 'setup_email_notification' ) );
46 | }
47 |
48 |
49 | /**
50 | * @param null $form_id
51 | *
52 | * @return array
53 | */
54 | public function get_extra_setting_fields( $form_id = null ) {
55 | return array(
56 | array(
57 | 'id' => "{$this->config['id']}_threshold_amount",
58 | 'name' => esc_html__( 'Threshold Amount', 'give' ),
59 | 'desc' => esc_html__( 'Enter the threshold amount for email. This email will be sent only if donor donation amount greater or equal to this amount.', 'give' ),
60 | 'default' => '',
61 | 'type' => 'text',
62 | ),
63 | );
64 | }
65 |
66 |
67 | /**
68 | * Get default email message.
69 | *
70 | * @since 2.0
71 | * @access public
72 | *
73 | * @return string
74 | */
75 | public function get_default_email_message() {
76 | $message = __( 'Dear {name},', 'give' ) . "\n\n";
77 | $message .= __( 'As I sat here this morning opening the mail, I came across your generous donation. I can’t tell you how much I appreciate your support.', 'give' ) . "\n";
78 | $message .= __( 'Your generous donation of {payment_total} will go a long way and beyond.', 'give' ) . "\n\n";
79 | $message .= __( '{name}, thank you once again for your donation. It means the world to us!.', 'give' ) . "\n\n";
80 | $message .= __( 'With gratitude,.', 'give' ) . "\n\n";
81 | $message .= __( '{sitename}.', 'give' ) . "\n\n";
82 |
83 | /**
84 | * Filter the default message
85 | */
86 | return apply_filters(
87 | "give_{$this->config['id']}_get_default_email_message",
88 | $message,
89 | $this
90 | );
91 | }
92 |
93 |
94 | /**
95 | * Set email data.
96 | */
97 | public function setup_email_data() {
98 | do_action( "give_{$this->config['id']}_setup_email_data", $this, $this->payment );
99 | }
100 |
101 | /**
102 | * Setup email notification.
103 | *
104 | * @access public
105 | *
106 | * @param int $payment_id
107 | */
108 | public function setup_email_notification( $payment_id ) {
109 | $this->payment = new Give_Payment( $payment_id );
110 |
111 | /**
112 | * Filter the threshold amount.
113 | */
114 | $threshold_donation_amount = apply_filters(
115 | "give_{$this->config['id']}_threshold_amount",
116 | Give_Email_Notification_Util::get_value( $this, "{$this->config['id']}_threshold_amount", $this->payment->form_id, '' ),
117 | $this->payment,
118 | $this
119 | );
120 |
121 | if ( ! empty( $threshold_donation_amount ) && $threshold_donation_amount <= $this->payment->total ) {
122 | // Set email data.
123 | $this->setup_email_data();
124 |
125 | // Send email.
126 | $this->send_email_notification( array(
127 | 'payment_id' => $payment_id,
128 | ) );
129 | }
130 | }
131 |
132 |
133 | /**
134 | * Register email notification.
135 | *
136 | * @param array $emails
137 | *
138 | * @return array
139 | */
140 | public function register( $emails ) {
141 | $emails[] = self::get_instance();
142 |
143 | return $emails;
144 | }
145 | }
146 |
147 | endif; // End class_exists check
148 |
149 | add_filter( 'give_email_notifications', array( Give_Donor_Gratitude_Email::get_instance(), 'register' ) );
--------------------------------------------------------------------------------
/email-customization/conditional-email-based-on-amount.php:
--------------------------------------------------------------------------------
1 | Hi {name}, ';
29 | $email_body .= 'Your donation to {form_title} was for {price} and that\'s great!
';
30 |
31 | } elseif ( $amount > 500 && $form_id === '1329' ) {
32 |
33 | // Here you can output custom content or pull from custom post meta using get_post_meta, or use an ACF field, WordPress functions, etc.
34 | // You can also use Give's email tags like {price}, {fullname}, etc.
35 | $email_body = 'Hi {name}, You are a rock star! Thanks for such a large gift
';
36 | }
37 |
38 | // Make sure we return the new $email_body;
39 | return $email_body;
40 | }
41 |
42 | add_filter( 'give_donation_receipt', 'my_custom_give_email_content', 10, 3 );
--------------------------------------------------------------------------------
/email-customization/custom-email-footer-text.php:
--------------------------------------------------------------------------------
1 | Some Words';
11 | }
12 |
13 | add_filter( 'give_email_footer_text', 'my_give_change_email_footer_text' );
14 |
--------------------------------------------------------------------------------
/email-customization/custom-email-headings.php:
--------------------------------------------------------------------------------
1 | get_notification_status() ) ) {
14 | do_action( 'give_admin_donation_email', $payment_id, $payment_data );
15 | }
16 |
17 | }
18 |
19 | add_action( 'give_complete_donation', 'my123_give_remove_donor_notification', 1 );
--------------------------------------------------------------------------------
/email-customization/magic-tag.php:
--------------------------------------------------------------------------------
1 | 'wohh_magic_tag',
14 | 'description' => esc_html__( 'This tag can be used to output conditional content in email notifications.', 'give-snippet' ),
15 | 'function' => 'rum_wohh_get_wohh_magic_tag_data',
16 | 'context' => 'general', // Context can be general, donor, form or donation
17 | );
18 |
19 | array_push( $email_tags, $new_email_tag );
20 |
21 | return $email_tags;
22 | }
23 | add_filter( 'give_email_tags', 'rum_wohh_add_magic_tag' );
24 |
25 | /**
26 | * Get Magic Tag Conditional Data
27 | *
28 | * Example function that returns Custom field data if present, for any form ID
29 | *
30 | * @param array $tag_args Email Tag Arguments.
31 | *
32 | * @return string
33 | */
34 | function rum_wohh_get_wohh_magic_tag_data( $tag_args ) {
35 |
36 | $payment_id = 0;
37 |
38 | switch ( true ) {
39 | case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
40 | $payment = new Give_Payment( $tag_args['payment_id'] );
41 | $payment_id = $payment->number;
42 | break;
43 | }
44 |
45 | $form_id = give_get_payment_form_id( $payment_id );
46 | $payment_meta = give_get_payment_meta( $payment_id );
47 | $meta_values = get_post_custom($payment_id);
48 | $output = '';
49 |
50 | // Check if this payment's donation form ID matches the donation form we want custom email body copy
51 | if ( $form_id === '1650' ) { // Online Donation form
52 |
53 | // get the custom field data for this donation.
54 | if ( ! empty( $meta_values['_give_payment_date'][0] ) ) {
55 | $output = sprintf(
56 | 'Payment Date for Donation: %1$s',
57 | $meta_values['_give_payment_date'][0]
58 | );
59 | }
60 | }
61 |
62 | if ( $form_id === '1865' ) { // Annual Memorial Walk Butterfly Campaign.
63 |
64 | if ( ! empty( $meta_values['my_donation_is_in_memory_of'][0] ) ) {
65 |
66 | $output = sprintf(
67 | 'In Memory Of: %1$s',
68 | $meta_values['my_donation_is_in_memory_of'][0]
69 | );
70 | }
71 | }
72 |
73 | return $output;
74 | }
75 |
76 |
77 |
--------------------------------------------------------------------------------
/email-customization/multi-level-name-only-email-tag.php:
--------------------------------------------------------------------------------
1 | 'give_donation_level', // The tag name.
13 | 'desc' => __( 'This outputs the level name of the donation amount for multi-level donations', 'give' ), // For admins.
14 | 'func' => 'give_level_name_email_tag_function', // Callback to function below.
15 | 'context' => 'donation', // This tag can be for both admin and donor notifications.
16 | 'is_admin' => false, // default is false. This is here to simply display it as an option.
17 | )
18 | );
19 | }
20 |
21 | add_action( 'give_add_email_tags', 'add_give_mailchimp_optin_email_tag' );
22 |
23 | /**
24 | * Callback function for the email tag output
25 | *
26 | * @return string
27 | */
28 | function give_level_name_email_tag_function( $tag_args ) {
29 |
30 | $args = array(
31 | 'only_level' => true,
32 | 'separator' => '',
33 | );
34 |
35 | $form_title = give_get_donation_form_title($tag_args['payment_id'], $args);
36 |
37 | $output = '';
38 |
39 | if ( ! empty( $form_title ) ) {
40 | $output = $form_title;
41 | }
42 |
43 | return $output;
44 | }
45 |
--------------------------------------------------------------------------------
/email-customization/register-email-template.php:
--------------------------------------------------------------------------------
1 | esc_html__( 'Custom Template', 'give' ),
17 | 'custom-2' => esc_html__( 'Custom 2 Template', 'give' ),
18 | 'custom-3' => esc_html__( 'Custom 3 Template', 'give' ),
19 | );
20 |
21 | $merged = array_merge($templates, $new);
22 |
23 | return $merged;
24 | }
25 |
--------------------------------------------------------------------------------
/email-customization/remove-new-user-notification.php:
--------------------------------------------------------------------------------
1 | ', '');
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/form-customizations/add-html-after-multilevel.php:
--------------------------------------------------------------------------------
1 | Available through 4/30 ';
18 | }
19 |
20 | // Return all Level Texts
21 | return $level_text;
22 | }
23 |
24 | add_filter( 'give_form_level_text', 'prefix_customize_give_buttons', 10, 3 );
25 |
--------------------------------------------------------------------------------
/form-customizations/auto-focuse-on-amount.php:
--------------------------------------------------------------------------------
1 |
10 |
13 |
14 | li {
17 | float: none;
18 | display: inline-block;
19 | }
--------------------------------------------------------------------------------
/form-customizations/css-customizations/rain-forest-demo-style.css:
--------------------------------------------------------------------------------
1 | /**
2 | * Rain Forest Demo Form Style
3 | *
4 | * The following CSS snippet is the base styles for the layout for this demo:
5 | * https://givewp.com/gdi-demo/#forms-multi
6 | * NOTE: This will only work if your form is using the MODAL display mode, and is a multi-level form with BUTTON style levels.
7 | * NOTE: Minor adjustments will be necessary depending on your theme.
8 | */
9 |
10 | .give-form-title {
11 | color: #68bb6c;
12 | text-align: center;
13 | font-weight: bold;
14 | }
15 |
16 | form[id*='give-form'], #give-recurring-form,
17 | form.give-form {
18 | margin-bottom: 0 !important;
19 | }
20 |
21 | div[id*="give-form"].give-form-wrap {
22 | background: #f0eee8;
23 | border-radius: 3px;
24 | border-color: #cbc9c4;
25 | padding: 15px;
26 | }
27 |
28 | form[id*="give-form"] {
29 | max-width: 600px;
30 | }
31 |
32 | form[id*="give-form"] .give-total-wrap {
33 | display: inline-block;
34 | float: left;
35 | clear: none;
36 | margin: 16px 0;
37 | position: relative;
38 | }
39 |
40 | form[id*="give-form"] ul#give-donation-level-button-wrap {
41 | float: right;
42 | max-width: 62%;
43 | clear: none;
44 | border-left: 1px solid #DDD;
45 | padding-left: 20px;
46 | position: relative;
47 | }
48 |
49 | /* Heart icon */
50 | form[id*="give-form"] ul#give-donation-level-button-wrap:before {
51 | content: "\e604";
52 | font-family: 'give-icomoon';
53 | font-style: normal;
54 | font-weight: normal;
55 | -webkit-font-smoothing: antialiased;
56 | -moz-osx-font-smoothing: grayscale;
57 | color: #68bb6c;
58 | font-size: 20px;
59 | background: transparent;
60 | padding: 3px 0;
61 | position: absolute;
62 | top: 16px;
63 | left: -10px;
64 | }
65 |
66 | form[id*="give-form"] #give-donation-level-button-wrap > li {
67 | list-style-type: none;
68 | list-style-image: none;
69 | width: 46%;
70 | margin: 0 2% 2%;
71 | float: left;
72 | }
73 |
74 | /* Last li containing the button is full width if using custom amount enabled form */
75 | form[id*="give-form"] #give-donation-level-button-wrap > li:last-child {
76 | width:100%;
77 | }
78 |
79 | form[id*="give-form"] ul#give-donation-level-button-wrap li button {
80 | width: 100%;
81 | margin: 0;
82 | background: #ffffff;
83 | color: #333;
84 | border: 1px solid #DDD;
85 | border-radius: 3px;
86 | }
87 |
88 | form[id*="give-form"] .give-btn-modal,
89 | [id*='give-form'].give-display-modal .give-btn {
90 | display: block;
91 | float: none;
92 | clear: both;
93 | width: 100%;
94 | color: #FFF;
95 | background: #546d78;
96 | border: none;
97 | text-transform: uppercase;
98 | margin: 0;
99 | }
100 |
--------------------------------------------------------------------------------
/form-customizations/css-customizations/style-givewp-iframes.php:
--------------------------------------------------------------------------------
1 | '',
15 | 'DE' => esc_html__( 'Germany', 'give' ),
16 | 'AT' => esc_html__( 'Austria', 'give' ),
17 | 'CH' => esc_html__( 'Switzerland', 'give' ),
18 | );
19 |
20 | return $countries;
21 | }
22 |
--------------------------------------------------------------------------------
/form-customizations/custom-default-featured-image.php:
--------------------------------------------------------------------------------
1 |
40 |
41 |
42 |
43 |
44 | *
45 |
46 |
48 |
49 |
50 |
51 |
52 |
53 | 'give_engraving_message',
77 | 'error_message' => __( 'Please enter a message for your engraving', 'give' ),
78 | );
79 | }
80 |
81 | return $required_fields;
82 | }
83 |
84 | add_filter( 'give_donation_form_required_fields', 'myprefix123_give_donations_require_fields', 10, 2 );
85 |
86 |
87 | /**
88 | * Add Field to Payment Meta
89 | *
90 | * Store the custom field data custom post meta attached to the `give_payment` CPT.
91 | *
92 | * @param $payment_id
93 | *
94 | * @return mixed
95 | */
96 | function myprefix123_give_donations_save_custom_fields( $payment_id ) {
97 |
98 | if ( isset( $_POST['give_engraving_message'] ) ) {
99 | $message = wp_strip_all_tags( $_POST['give_engraving_message'], true );
100 | give_update_payment_meta( $payment_id, 'give_engraving_message', $message );
101 | }
102 |
103 | }
104 |
105 | add_action( 'give_insert_payment', 'myprefix123_give_donations_save_custom_fields' );
106 |
107 | /**
108 | * Show Data in Transaction Details
109 | *
110 | * Show the custom field(s) on the transaction page.
111 | *
112 | * @param $payment_id
113 | */
114 | function myprefix123_give_donations_donation_details( $payment_id ) {
115 |
116 | $engraving_message = give_get_meta( $payment_id, 'give_engraving_message', true );
117 |
118 | if ( $engraving_message ) : ?>
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 | __( 'Engraved Message', 'give' ),
187 | 'value' => wp_kses_post( $engraving_message ),
188 | // Do not show Engraved field if empty
189 | 'display' => empty( $engraving_message ) ? false : true,
190 | );
191 | }
192 |
193 | return $args;
194 | }
195 |
196 | add_filter( 'give_donation_receipt_args', 'myprefix123_donation_receipt_args', 30, 3 );
197 |
198 |
199 | /**
200 | * Add Donation engraving message fields in export donor fields tab.
201 | */
202 | function myprefix123_donation_standard_donor_fields() {
203 | ?>
204 |
205 |
206 |
209 |
210 |
211 | get_meta( 'give_engraving_message' );
248 | $data['give_engraving_message'] = isset( $message ) ? wp_kses_post( $message ) : '';
249 | }
250 |
251 | return $data;
252 | }
253 |
254 | add_filter( 'give_export_donation_data', 'myprefix123_export_donation_data', 10, 3 );
255 |
256 | /**
257 | * Remove Custom meta fields from Export donation standard fields.
258 | *
259 | * @param array $responses Contain all the fields that need to be display when donation form is display
260 | * @param int $form_id Donation Form ID
261 | *
262 | * @return array $responses
263 | */
264 | function myprefix123_export_custom_fields( $responses, $form_id ) {
265 | // Only display for forms with the IDs "754" and "578";
266 | // Remove "If" statement to display on all forms
267 | // For a single form, use this instead:
268 | // if ( $form_id == 754) {
269 | $forms = array( 754, 578 );
270 | if ( in_array( $form_id, $forms ) && ! empty( $responses['standard_fields'] ) ) {
271 | $standard_fields = $responses['standard_fields'];
272 | if ( in_array( 'give_engraving_message', $standard_fields ) ) {
273 | $standard_fields = array_diff( $standard_fields, array( 'give_engraving_message' ) );
274 | $responses['standard_fields'] = $standard_fields;
275 | }
276 | }
277 |
278 | return $responses;
279 | }
280 |
281 | add_filter( 'give_export_donations_get_custom_fields', 'myprefix123_export_custom_fields', 10, 2 );
282 |
--------------------------------------------------------------------------------
/form-customizations/custom-offline-donation-receipt-instructions.php:
--------------------------------------------------------------------------------
1 | Thanks for agreeing to donate! ";
15 | $custom .= " Here's the steps:
";
16 | $custom .= " Mail your check to us at the address listed below ";
17 | $custom .= " We'll email you a receipt to the email you submitted. ";
18 | $custom .= " 123 YourAddress";
19 | $custom .= " AnyTown ";
20 | $custom .= " North Carolina, 27777 ";
21 | $custom .= " Thanks so much for your donation!
";
22 |
23 | return $custom;
24 | }
--------------------------------------------------------------------------------
/form-customizations/custom-per-form-currency.php:
--------------------------------------------------------------------------------
1 | 'Pennsylvania',
14 | 'NY' => 'New York',
15 | );
16 |
17 | return $states;
18 | }
19 |
20 | add_filter( 'give_us_states', 'my_give_custom_us_states_list');
--------------------------------------------------------------------------------
/form-customizations/customize-fieldset-order.php:
--------------------------------------------------------------------------------
1 |
8 |
12 |
13 |
9 |
10 |
15 |
16 |
25 |
26 | ";
24 |
25 | // to display AMEX, leave this line as is. Otherwise, delete it.
26 | $output .= " ";
27 |
28 | // to display Diners Club, leave this line as is. Otherwise, delete it.
29 | $output .= " ";
30 |
31 | // to display DISCOVER, leave this line as is. Otherwise, delete it.
32 | $output .= " ";
33 |
34 | // to display JCB, leave this line as is. Otherwise, delete it.
35 | $output .= " ";
36 |
37 | // to display MAESTRO, leave this line as is. Otherwise, delete it.
38 | $output .= " ";
39 |
40 | // to display MASTERCARD, leave this line as is. Otherwise, delete it.
41 | $output .= " ";
42 |
43 | // to display UNIONPAY, leave this line as is. Otherwise, delete it.
44 | $output .= " ";
45 |
46 | // to display VISA, leave this line as is. Otherwise, delete it.
47 | $output .= " ";
48 |
49 | $output .= '';
50 |
51 | echo wp_kses_post( $output );
52 | }
53 |
54 |
55 | add_action( 'give_before_cc_fields', 'my_give_display_accepted_card_images' );
56 |
--------------------------------------------------------------------------------
/form-customizations/dont-require-fields.php:
--------------------------------------------------------------------------------
1 | is_post_type_archive( 'give_forms' ) ) {
15 | $query->set( 'post__not_in', array( 1, 13, 266 ) );
16 | }
17 | }
18 |
19 | add_action( 'pre_get_posts', 'my_custom_get_posts', 1 );
20 |
--------------------------------------------------------------------------------
/form-customizations/fields-api-sample.php:
--------------------------------------------------------------------------------
1 | append(
11 | give_field( 'text', 'myTextField' )
12 | ->label( 'My Text Field' )
13 | ->required() // Could instead be marked as readOnly() (optional)
14 | ->helpText( __( 'This is my custom text field.' ) )
15 | );
16 | });
17 |
18 |
19 | add_action( 'give_fields_payment_mode_before_gateways', function( $collection ) {
20 |
21 | // Show in the Donation Receipt (for the legacy template uses the donation confirmation).
22 | $collection->append(
23 | give_field( 'text', 'myTextField' )
24 | ->label( 'My Text Field' )
25 | ->showInReceipt()
26 | );
27 | });
28 |
29 |
30 | add_action( 'give_fields_payment_mode_before_gateways', function( $collection ) {
31 |
32 | // Store a field value as Donor Meta (instead of Donation Meta).
33 | $collection->append(
34 | give_field( 'text', 'myTextField' )
35 | ->label( 'My Text Field' )
36 | ->storeAsDonorMeta() // Otherwise store as Donation Meta (default)
37 | ->showInReceipt() // When stored as Donor meta it uses the Donor section of the receipt.
38 | );
39 | });
40 |
41 |
42 | add_action( 'give_fields_payment_mode_before_gateways', function( $collection ) {
43 |
44 | // Add support for an email tag.
45 | $collection->append(
46 | give_field( 'text', 'myTextField' )
47 | ->label( 'My Text Field' )
48 | ->emailtag( 'my-text-field' )
49 | );
50 | });
51 |
52 | add_action( 'give_fields_payment_mode_before_gateways', function( $collection ) {
53 | $collection->append(
54 |
55 | // Select field with options.
56 | give_field( 'select', 'mySelectField' )
57 | ->label( 'My Select Field' )
58 | ->options(
59 | [ 'aye', __( 'Aye' ) ],
60 | [ 'bee', __( 'Bee' ) ]
61 | )
62 |
63 | );
64 | });
65 |
--------------------------------------------------------------------------------
/form-customizations/gdpr-save-terms-to-donation-meta.php:
--------------------------------------------------------------------------------
1 |
28 |
30 |
41 |
42 |
43 |
44 | *
45 |
46 |
47 |
48 |
49 |
50 |
119 |
120 | __( 'Number of Tickets', 'give' ),
146 | 'value' => Give()->payment_meta->get_meta( $donation_id, 'give_ticket_number', true ),
147 | 'display' => true,
148 | );
149 | }
150 |
151 | return $give_receipt_args;
152 | }
153 |
154 | add_filter( 'give_donation_receipt_args', 'give_tickets_add_field_to_donation_receipt', 10, 3 );
155 |
156 | /**
157 | * This function will save the number of tickets value to DB.
158 | *
159 | * @param int $donation_id Donation ID.
160 | */
161 | function give_tickets_save_ticket_amount( $donation_id ) {
162 |
163 | $post_data = give_clean( $_POST );
164 |
165 | if ( isset( $post_data['give_ticket_number'] ) ) {
166 | $ticket_amount = $post_data['give_ticket_number'];
167 |
168 | Give()->payment_meta->add_meta( $donation_id, 'give_ticket_number', $ticket_amount );
169 | }
170 | }
171 |
172 | add_action( 'give_insert_payment', 'give_tickets_save_ticket_amount', 10, 1 );
173 |
174 | /**
175 | * This function will update the donation amount based on the number of tickets selected.
176 | *
177 | * @param array $donation_data List of donation data.
178 | *
179 | * @return array
180 | */
181 | function give_tickets_update_ticket_amount( $donation_data ) {
182 | $tickets_present = $donation_data['post_data']['give_ticket_number'];
183 |
184 | if ( $tickets_present ) {
185 | $donation_data['price'] = $donation_data['price'] * $donation_data['post_data']['give_ticket_number'];
186 | }
187 |
188 | return $donation_data;
189 | }
190 |
191 | add_filter( 'give_donation_data_before_gateway', 'give_tickets_update_ticket_amount', 10, 1 );
192 |
193 | /**
194 | * This function will display the number of tickets data in admin.
195 | *
196 | * @param int $donation_id Donation ID.
197 | */
198 | function give_tickets_ticket_amount_donation_meta( $donation_id ) {
199 |
200 | // Bounce out if no data for this transaction
201 | $no_of_tickets = Give()->payment_meta->get_meta( $donation_id, 'give_ticket_number', true );
202 |
203 | if ( $no_of_tickets ) : ?>
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
8 |
9 |
21 |
22 | success ) && ! $recaptcha_data->success == true ) {
27 | // User must have validated the reCAPTCHA to proceed with donation.
28 | if ( ! isset( $data['g-recaptcha-response'] ) || empty( $data['g-recaptcha-response'] ) ) {
29 | give_set_error( 'g-recaptcha-response', __( 'Please verify that you are not a robot.', 'give' ) );
30 | }
31 | }
32 |
33 | return $valid_data;
34 | }
35 |
36 | add_action( 'give_checkout_error_checks', 'give_myprefix_validate_recaptcha', 10, 2 );
37 |
38 | /**
39 | * Enqueue ReCAPTCHA Scripts
40 | */
41 | function give_myprefix_recaptcha_scripts() {
42 | wp_register_script( 'give-captcha-js', 'https://www.google.com/recaptcha/api.js' );
43 | // If you only want to enqueue on single form pages then uncomment if statement
44 | // if ( is_singular( 'give_forms' ) ) {
45 | wp_enqueue_script( 'give-captcha-js' );
46 | // }
47 | }
48 |
49 | add_action( 'wp_enqueue_scripts', 'give_myprefix_recaptcha_scripts' );
50 |
51 | /**
52 | * Print Necessary Inline JS for ReCAPTCHA
53 | *
54 | * This function outputs the appropriate inline js ReCAPTCHA scripts in the footer
55 | */
56 | function give_myprefix_print_my_inline_script() {
57 | // Uncomment if statement to control output
58 | // if ( is_singular( 'give_forms' ) ) {
59 | ?>
60 |
67 |
86 |
88 | get_earnings();
15 | $goal = $form->goal;
16 | $donations_goal = give_get_meta( $form_id, '_give_number_of_donation_goal', true );
17 | $donations_completed = give_get_form_sales_stats( $form_id );
18 |
19 | return 'donation' === $goal_format ? ( $donations_completed >= $donations_goal ? 100 : $progress ) : ( $income >= $goal ? 100 : $progress );
20 | }
21 |
22 |
23 | add_filter( 'give_goal_amount_funded_percentage_output', 'limit_donation_exceed_to_100', 10, 3 );
--------------------------------------------------------------------------------
/form-customizations/multilevel-recurring-text-separator.php:
--------------------------------------------------------------------------------
1 | Special Thanks to our Donors:';
21 | echo do_shortcode('[give_donor_wall form_id="' . $form . '"]');
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/form-customizations/populate-amount-from-url.php:
--------------------------------------------------------------------------------
1 |
26 |
27 |
61 |
62 |
17 |
97 | '', 'FR' => $name ) + $countries;
25 |
26 | return $countries;
27 | }
28 |
29 | add_filter( 'give_countries', 'my_give_custom_country_list');
--------------------------------------------------------------------------------
/form-customizations/remove-goal-human-readable-format.php:
--------------------------------------------------------------------------------
1 | false,
16 | ) );
17 |
18 | return $amount;
19 | }
20 |
21 | add_filter( 'give_human_format_large_amount', 'my_remove_give_human_readable_filter', 10, 3 );
22 |
--------------------------------------------------------------------------------
/form-customizations/require-last-name.php:
--------------------------------------------------------------------------------
1 | 'invalid_last_name',
17 | 'error_message' => __( 'Please enter your last name', 'give' )
18 | );
19 |
20 | //If restricting by gateway:
21 | $stripe = give_is_gateway_active( 'give-stripe' );
22 |
23 | if ($stripe) {
24 | $required_fields['card_state'] = array(
25 | 'error_id' => 'invalid_card_state',
26 | 'error_message' => __( 'Please enter your Credit Cards billing State.', 'give-stripe' )
27 | );
28 | }
29 |
30 | return $required_fields;
31 | }
32 |
33 | add_filter( 'give_donation_form_required_fields', 'give_require_last_name', 10, 2 );
34 |
--------------------------------------------------------------------------------
/form-customizations/validate-donation-amount.php:
--------------------------------------------------------------------------------
1 | = $max_amount ) {
25 | give_set_error( 'give_message', sprintf( __( 'Sorry, we can\'t accept donations more than %s.', 'give' ), give_currency_filter( give_format_amount( $max_amount ) ) ) );
26 | }
27 |
28 | }
29 |
30 | add_action( 'give_checkout_error_checks', 'give_donations_validate_donation_amount', 10, 2 );
--------------------------------------------------------------------------------
/gateway-customizations/add-billing-fields-to-offline-donations.php:
--------------------------------------------------------------------------------
1 | esc_attr__( 'Facebook Donations (DO NOT ENABLE)', 'give-free' ),
15 | 'checkout_label' => esc_attr__( 'Facebook Donations (External)', 'give-free' )
16 | );
17 |
18 | $gateways['give_crowdrise'] = array(
19 | 'admin_label' => esc_attr__( 'Crowdrise Donations (DO NOT ENABLE)', 'give-free' ),
20 | 'checkout_label' => esc_attr__( 'Crowdrise Donations (External)', 'give-free' )
21 | );
22 |
23 | return $gateways;
24 | } );
25 |
--------------------------------------------------------------------------------
/gateway-customizations/authorizenet-custom-invoice-prefix.php:
--------------------------------------------------------------------------------
1 | phoneNumber = $phone;
20 |
21 | return $args;
22 |
23 | }
24 |
25 | add_filter( 'give_authorize_payment_args', 'my_prefix_authorizenet_phone', 100 );
26 |
--------------------------------------------------------------------------------
/gateway-customizations/ccavenue-per-form-accounts.php:
--------------------------------------------------------------------------------
1 | 'INSERT MERCHANT ID FOR THIS FORM HERE',
20 | 'working_key' => 'INSERT WORKING KEY FOR THIS FORM HERE',
21 | 'access_code' => 'INSERT ACCESS CODE FOR THIS FORM HERE',
22 | );
23 | } elseif ( 20 === $form_id ) {
24 | $credentials = array(
25 | 'merchant_id' => 'INSERT MERCHANT ID FOR THIS FORM HERE',
26 | 'working_key' => 'INSERT WORKING KEY FOR THIS FORM HERE',
27 | 'access_code' => 'INSERT ACCESS CODE FOR THIS FORM HERE',
28 | );
29 | }
30 |
31 | // Important to always return credentials.
32 | // If none of the form ID conditions are me above then it will return the global settings credentials.
33 | return $credentials;
34 | }
35 |
36 | add_filter( 'give_ccavenue_get_merchant_credentials', 'my_customer_give_ccavenue_per_form_credentials', 10, 1 );
--------------------------------------------------------------------------------
/gateway-customizations/disable-gateway-on-frontend.php:
--------------------------------------------------------------------------------
1 | array(
32 | 'id' => "{$prefix}_options",
33 | 'title' => __( 'PayPal Options', 'give' ),
34 | 'fields' => array(
35 | // PayPal Standard
36 | array(
37 | 'name' => __( 'PayPal Standard Success Page', 'give' ),
38 | 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '[give_receipt]
' ),
39 | 'id' => "{$prefix}_standard_success_page",
40 | 'type' => 'select',
41 | 'options' => give_cmb2_get_post_options( array(
42 | 'post_type' => 'page',
43 | 'numberposts' => - 1,
44 | ), true ),
45 | ),
46 | // PayPal Pro Option
47 | array(
48 | 'name' => __( 'PayPal Pro Success Page', 'give' ),
49 | 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '[give_receipt]
' ),
50 | 'id' => "{$prefix}_pro_success_page",
51 | 'type' => 'select',
52 | 'options' => give_cmb2_get_post_options( array(
53 | 'post_type' => 'page',
54 | 'numberposts' => - 1,
55 | ), true ),
56 | ),
57 | ),
58 | ),
59 | );
60 |
61 | return array_merge( $settings, $pp_custom_settings );
62 | }
63 |
64 | // Per-Form Meta box settings.
65 | add_action( 'give_metabox_form_data_settings', 'give_custom_pp_metabox_settings', 10, 1 );
66 |
67 |
68 | /**
69 | * Custom PayPal Standard Success Redirect.
70 | *
71 | * This uses the option created above.
72 | *
73 | * @param $paypal_args
74 | * @param $payment_data
75 | *
76 | * @return array $paypal_args
77 | */
78 | function give_custom_pp_standard_redirect( $paypal_args, $payment_data ) {
79 | $form_id = intval( $payment_data['post_data']['give-form-id'] );
80 | $form_success_page = give_get_meta( $form_id, 'give_custom_pp_redirects_fields_standard_success_page', true );
81 |
82 | // If this donation form has a custom PP Standard success page.
83 | if ( ! empty( $form_success_page ) ) {
84 | $paypal_args['return'] = get_permalink( $form_success_page );
85 | }
86 |
87 | return $paypal_args;
88 |
89 | }
90 |
91 | add_filter( 'give_recurring_paypal_args', 'give_custom_pp_standard_redirect', 10, 2 );
92 | add_filter( 'give_paypal_redirect_args', 'give_custom_pp_standard_redirect', 10, 2 );
93 |
94 |
95 | /**
96 | * Custom PayPal Pro gateway success redirect.
97 | *
98 | * @param $success_page
99 | *
100 | * @return string $redirect URL where to redirect donors.
101 | */
102 | function give_custom_pp_pro_redirect( $success_page ) {
103 |
104 | $form_id = isset( $_REQUEST['give-form-id'] ) ? sanitize_text_field($_REQUEST['give-form-id']) : '';
105 | $gateway = isset( $_REQUEST['payment-mode'] ) ? sanitize_text_field($_REQUEST['payment-mode']) : 'manual';
106 |
107 | $form_success_page = give_get_meta( $form_id, 'give_custom_pp_redirects_fields_pro_success_page', true );
108 |
109 | $pp_pro_gateways = array('paypalpro_payflow', 'paypalpro', 'paypalpro_rest');
110 |
111 | // If this donation form has a custom PP Standard success page.
112 | if ( ! empty( $form_success_page ) && in_array($gateway, $pp_pro_gateways) ) {
113 | $success_page = get_permalink( $form_success_page );
114 | }
115 |
116 | return $success_page;
117 |
118 | }
119 |
120 | add_filter( 'give_success_page_url', 'give_custom_pp_pro_redirect', 10, 1 );
121 | add_filter( 'give_get_success_page_uri', 'give_custom_pp_pro_redirect', 1, 1 );
--------------------------------------------------------------------------------
/gateway-customizations/paypal/paypal-payflow-customize-comments.php:
--------------------------------------------------------------------------------
1 | 'paypal',
20 | ), give_get_current_page_url() );
21 |
22 | if ( isset( $paypal_args['cancel_return'] ) ) {
23 | $paypal_args['cancel_return'] = $cancel_url;
24 | }
25 |
26 | return $paypal_args;
27 |
28 | }
29 |
30 | add_filter( 'give_paypal_redirect_args', 'give_customize_paypal_failed_redirect', 10, 2 );
--------------------------------------------------------------------------------
/gateway-customizations/paypal/paypal-standard-mutliple-accounts.php:
--------------------------------------------------------------------------------
1 | Settings > Payment Gateways > PayPal Standard
10 | *
11 | * @param $paypal_args
12 | * @param $payment_data
13 | *
14 | * @return array $paypal_args
15 | */
16 | function my_custom_multiple_paypal_accounts( $paypal_args, $payment_data ) {
17 |
18 | $form_id = isset( $payment_data['post_data']['give-form-id'] ) ? $payment_data['post_data']['give-form-id'] : '';
19 |
20 | // If this form is ID '144' then we customize the email for it.
21 | if('144' === $form_id ) {
22 | // Customize the email address for this form's email
23 | $paypal_args['business'] = 'mypaypal@email.com';
24 | }
25 |
26 | // Always return the paypal args.
27 | return $paypal_args;
28 |
29 | }
30 |
31 | add_filter( 'give_paypal_redirect_args', 'my_custom_multiple_paypal_accounts', 10, 2 );
32 | add_filter( 'give_recurring_paypal_args', 'my_custom_multiple_paypal_accounts', 10, 2 );
33 |
--------------------------------------------------------------------------------
/gateway-customizations/stripe-pass-custom-meta-for-customers.php:
--------------------------------------------------------------------------------
1 | isset( $_POST['custom_field_meta_key_1'] ) ? $_POST['custom_field_meta_key_1'] : '',
16 | 'custom_field_2' => isset( $_POST['custom_field_meta_key_2'] ) ? $_POST['custom_field_meta_key_2'] : '',
17 | 'custom_field_3' => isset( $_POST['custom_field_meta_key_3'] ) ? $_POST['custom_field_meta_key_3'] : '',
18 | );
19 |
20 | $metadata = array_merge( $metadata, $custom_meta_fields );
21 |
22 | return $metadata;
23 |
24 | }
25 |
26 |
27 | add_filter( 'give_stripe_customer_metadata', 'my_give_custom_stripe_meta', 10, 2 );
28 |
--------------------------------------------------------------------------------
/gateway-customizations/stripe-pass-custom-meta-for-payments.php:
--------------------------------------------------------------------------------
1 | ! empty( $posted_data['text_field'] ) ? $posted_data['text_field'] : 'undefined',
21 | 'Dropdown Field' => ! empty( $posted_data['dropdown_field'] ) ? $posted_data['dropdown_field'][0] : 'undefined',
22 | 'Donor Comment' => ! empty( $posted_data['give_comment'] ) ? $posted_data['give_comment'] : '',
23 | );
24 | $charge_args['metadata'] = array_merge( $charge_args['metadata'], $custom_meta_fields );
25 |
26 | return $charge_args;
27 | }
28 | add_filter( 'give_stripe_create_intent_args', 'give_stripe_custom_payment_meta', 10 );
29 |
30 | // for the Stripe Checkout modal, uncomment the next line.
31 | // add_filter( 'give_stripe_create_intent_args', 'give_stripe_custom_payment_meta', 10 );
32 |
--------------------------------------------------------------------------------
/theme-compatibility/avada-compatibility.md:
--------------------------------------------------------------------------------
1 | ## How to make the Eduma Theme Compatibile with Give
2 |
3 | 1. If you are using Avada theme then you will get following issues:
4 | 1. Donation amount set to 0.
5 | 2. Sequential ID does not set.
6 |
7 | Note: Mainly this issue appears on Dreamhost when memcached enabled [Read More](https://github.com/WordImpress/Give/issues/3199).
8 |
9 | To fix this issue add this custom below function to your child theme's functions.php or add to this plugin https://wordpress.org/plugins/my-custom-functions/:
10 |
11 | ```
12 | function fusion_flush_object_cache(){}
13 | ```
14 |
--------------------------------------------------------------------------------
/theme-compatibility/conditional-script-loading.php:
--------------------------------------------------------------------------------
1 | ';
12 | }
13 |
14 | add_filter( 'give_default_wrapper_start', 'my_custom_give_start_wrapper' );
15 |
16 | /**
17 | * Custom Give Single Template Wrapper End
18 | */
19 | function my_custom_give_end_wrapper() {
20 | echo '';
21 | }
22 |
23 | add_filter( 'give_default_wrapper_end', 'my_custom_give_end_wrapper' );
--------------------------------------------------------------------------------
/theme-compatibility/eduma-compatibility.md:
--------------------------------------------------------------------------------
1 | ## How to make the Eduma Theme Compatibile with Give
2 |
3 | 1. Add this custom function to your functions.php file:
4 | ```
5 | add_action('wp_footer', 'give_fix_js_theme_conflict');
6 |
7 | function give_fix_js_theme_conflict() { ?>
8 |
18 |
19 | ';
28 | $templatestart .= '';
29 |
30 | return $templatestart;
31 | }
32 |
33 | function eduma_give_template_end() {
34 | $templateend = '
';
35 |
36 | return $templateend;
37 | }
38 | ```
39 |
40 | 2. Add this to your theme's style.css file:
41 | ```
42 | body.single.give-page article .entry-summary {
43 | clear:none;
44 | }
45 | ```
46 |
--------------------------------------------------------------------------------
/theme-compatibility/impreza-modal-fixes.css:
--------------------------------------------------------------------------------
1 | /**
2 | * Fixes the "X" on our Modal for the Impreza theme
3 | *
4 | */
5 |
6 | .mfp-wrap.give-modal form .mfp-close {
7 | display: inline-block !important;
8 | }
9 |
10 | .mfp-wrap.give-modal .mfp-container:after {
11 | display: none;
12 | }
13 |
--------------------------------------------------------------------------------
/theme-compatibility/kadencewp-theme.php:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
21 |
22 |
31 |
32 |
38 |
39 |
42 |
43 |
44 | "
6 | *
7 | * Add this snippet and it will be removed.
8 | */
9 | function remove_give_version_in_header() {
10 | remove_action( 'wp_head', 'give_version_in_header' );
11 | }
12 |
13 | add_action( 'wp_head', 'remove_give_version_in_header', 1 );
--------------------------------------------------------------------------------
/theme-compatibility/unselectize-give.php:
--------------------------------------------------------------------------------
1 |
16 |
29 | becoming one today.', 'give-recurring' );
12 | }
13 |
14 | return $translations;
15 | }
16 |
17 | add_filter( 'gettext', 'my_give_recurring_message_switcher', 10, 3 );
18 |
--------------------------------------------------------------------------------
/translation-snippets/simple-translation-snippet.php:
--------------------------------------------------------------------------------
1 | 30,
24 | 'form_id' => null,
25 | 'heading' => 'We\'d like to thank the following gracious donors:',
26 | ), $atts, 'my_donor_list' );
27 |
28 | $args = array(
29 | 'output' => 'payments',
30 | 'number' => $atts['number'],
31 | 'status' => 'publish',
32 | 'give_forms' => $atts['form_id'],
33 |
34 | );
35 |
36 | $payments = new Give_Payments_Query( $args );
37 | $payments = $payments->get_payments();
38 |
39 | if ( $payments ) : ?>
40 |
89 |
90 |
91 |
92 | get_meta( '_give_donor_billing_first_name', true );
100 | $last_name = $payment->get_meta( '_give_donor_billing_last_name', true );
101 |
102 | $total = give_donation_amount( $payment->ID, array( 'currency' => true ) );
103 | $avatar = get_avatar( $payment->email, 64 );
104 | ?>
105 |
106 |
107 |
108 |
111 |
112 |
113 |
114 |
115 |
116 |
117 | Sorry you don't have any donation payments that fit this query
118 |
119 | Settings --> Display )
14 | *
15 | */
16 |
17 | get_header();
18 | ?>
19 |
20 |
21 |
22 | 'give_forms',
28 | 'posts_per_page' => 10
29 | );
30 |
31 | $wp_query = new WP_Query( $args );
32 |
33 | if ( $wp_query->have_posts() ) : ?>
34 |
35 | Choose a Donation
36 |
37 |
38 | have_posts() ) : $wp_query->the_post(); ?>
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
60 |
61 |
»
62 |
63 |
64 |
65 |
66 |
68 |
69 |
72 |
73 | Sorry, no donations found.
74 |
75 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/useful-queries/recent-donors-shortcode.php:
--------------------------------------------------------------------------------
1 | donors->count() );
11 | $number = 100;
12 | $less_then_100 = false;
13 |
14 | if ( $total_donors < 100 ) {
15 | $number = $total_donors;
16 | $less_then_100 = true;
17 | }
18 |
19 | // Get the latest 100 Give Donors
20 | $args = array(
21 | 'number' => $number,
22 | );
23 |
24 | $donors = Give()->donors->get_donors( $args );
25 |
26 | $output = array();
27 |
28 | foreach ( $donors as $donor ) {
29 |
30 | // Create Donor Object.
31 | $donor = new Give_Donor( $donor->id );
32 |
33 | // Get First Name.
34 | $first_name = $donor->get_first_name();
35 |
36 | // Get Last Name Initial Letter.
37 | $last_name = $donor->get_last_name();
38 |
39 | // Prepare Output.
40 | $output[] = "{$first_name} {$last_name}";
41 |
42 | }
43 |
44 | $output = implode( ', ', $output );
45 |
46 |
47 | if ( ! empty( $output ) && empty( $less_then_100 ) ) {
48 | $output .= __( ' and many more.', 'give' );
49 | }
50 |
51 | return $output;
52 |
53 | }
54 |
55 | add_shortcode( 'donor_list', 'give_basic_recent_donors_function' );
--------------------------------------------------------------------------------
/useful-queries/sample-transaction-queries.php:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 | 1 ) );
37 | $payments = $testquery->get_payments();
38 |
39 | if ( $payments ) {
40 | foreach ( $payments as $payment ) {
41 | $meta = give_get_meta( $payment->ID );
42 | ?>
43 |
44 |
Test Data
45 |
The following outputs all the "give_payment" fields for you to reference in building out your
46 | donation list
47 |
48 |
49 |
55 |
56 | 3
67 | );
68 |
69 | $loop1 = new Give_Payments_Query( $args );
70 | $loop1 = $loop1->get_payments();
71 |
72 |
73 | if ( $loop1 ) {
74 | ?>
75 | Output latest 3 donations with amount and date
76 |
77 |
78 |
81 |
82 | Donation for $total ); ?>
83 | Was given on date ) ) ); ?>
84 | With the gateway ); ?> Payment Gateway
85 |
86 |
89 |
90 |
93 |
94 | Sorry you don't have any transactions that fit this query
95 |
98 |
99 | 3,
110 | 'meta_key' => '_give_payment_gateway',
111 | 'meta_value' => 'manual',
112 | 'meta_compare' => '=',
113 | );
114 |
115 | $loop2 = new Give_Payments_Query( $args );
116 | $loop2 = $loop2->get_payments();
117 |
118 | if ( $loop2 ) {
119 | ?>
120 | Output latest 3 Offline donations with amount and email address
121 |
122 |
123 |
126 |
127 | Donation for $total ); ?>
128 | Was given on date ) ) ); ?>
129 | With the gateway ); ?> Payment Gateway
130 |
131 |
134 |
135 |
138 |
139 | Sorry you don't have any transactions that fit this query
140 |
143 |
144 | 3
155 | );
156 |
157 | $loop3 = new Give_Payments_Query( $args );
158 | $loop3 = $loop3->get_payments();
159 |
160 | if ( $loop3 ) {
161 | ?>
162 | Output latest 3 donations with amount and names
163 |
164 |
165 |
168 |
169 | Thanks to first_name . ' ' . $payment->last_name ); ?>
170 | For their generous gift of $total ); ?>
171 |
172 |
175 |
176 |
179 |
180 | Sorry you don't have any transactions that fit this query
181 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
--------------------------------------------------------------------------------