This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Give\ValueObjects\Money; | |
| use Give\Donations\Models\Donation; | |
| function give_add_donation_level_pdf_tag( $template_content, $args ) { | |
| // during testing, uncomment the next line to see a full printed array of the possible args that you can query | |
| //var_dump("<pre>".print_r($args,true)."</pre>"); | |
| $level_label = ''; | |
| $currency = give_get_option('currency'); | |
| $form_id = give_get_payment_form_id( $args['donation_id'] ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Change the wp_ prefix to match the WP prefix on your site | |
| -- Create give_campaigns table | |
| CREATE TABLE wp_give_campaigns ( | |
| id INT UNSIGNED NOT NULL AUTO_INCREMENT, | |
| campaign_page_id INT UNSIGNED NULL, | |
| form_id INT NOT NULL, | |
| campaign_type VARCHAR(12) NOT NULL DEFAULT '', | |
| campaign_title TEXT NOT NULL, | |
| campaign_url TEXT NOT NULL, | |
| short_desc TEXT NOT NULL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Allow editors to edit/delete ONLY pages that have the give_campaign_id meta key. | |
| */ | |
| /** | |
| * Map meta caps so editors may only edit/delete posts that have give_campaign_id. | |
| * | |
| * @param array $caps Mapped capabilities to return. | |
| * @param string $cap Capability being checked. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Remove the inline styles from the doantion receipt page | |
| add_action('wp_print_scripts', function () { | |
| wp_add_inline_script('givewp-donation-confirmation-receipt', 'document.addEventListener("DOMContentLoaded", function () { | |
| // Run after a short delay to ensure UI is ready | |
| setTimeout(() => { | |
| const element = document.getElementById("root-givewp-donation-confirmation-receipt"); | |
| element.removeAttribute("style"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function getYears(): array | |
| { | |
| $startYear = 1970; | |
| $currentYear = date('Y'); | |
| return range($startYear, $currentYear); | |
| } | |
| add_action('givewp_donation_form_schema', static function (Give\Framework\FieldsAPI\DonationForm $form) { | |
| $field = Give\Framework\FieldsAPI\Select::make('grduation_year') | |
| ->options(...getYears()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action("givewp_donation_form_enqueue_scripts", function () { | |
| ?> | |
| <script> | |
| document.addEventListener("DOMContentLoaded", function () { | |
| // Run after a short delay to ensure UI is ready | |
| setTimeout(() => { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Log donation data in Donations -> Tools -> Logs. | |
| * | |
| * @param int $payment_id The ID of the inserted payment. | |
| * @param array $payment_data The payment data array, which includes payment_meta. | |
| */ | |
| function log_givewp_payment_meta( $payment_id, $payment_data ) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function give_export_give_cs_base_amount() { | |
| ?> | |
| <tr class="give-export-option-fields give-export-option-custom-field"> | |
| <td scope="row" class="row-title"> | |
| <label><?php esc_html_e( 'Base amount:', 'give' ); ?></label> | |
| </td> | |
| <td class="give-field-wrap"> | |
| <div class="give-clearfix"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Add {company_or_name} tag to GiveWP PDF Receipts using the give_pdf_compiled_template_content filter. | |
| * Outputs the Company name if provided, otherwise outputs donor's full name. | |
| */ | |
| add_filter( 'give_pdf_compiled_template_content', function( $template_content, $args ) { | |
| //var_dump("<pre>".print_r($args,true)."</pre>"); | |
| // | |
| // Make sure payment ID is available. | |
| $payment_id = ! empty( $args['donation_id'] ) ? absint( $args['donation_id'] ) : 0; |
NewerOlder