Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rickalday
rickalday / give_export_transaction_id.php
Created March 1, 2024 17:14
Add a checkbox to export the donation Transaction ID in GiveWP donation history export
<?php
function give_export_transaction_id() {
?>
<tr class="give-export-option-fields give-export-option-custom-field">
<td scope="row" class="row-title">
<label><?php esc_html_e( 'Transaction ID:', 'give' ); ?></label>
</td>
<td class="give-field-wrap">
<div class="give-clearfix">
@rickalday
rickalday / export_option_givewp_mc_fields.php
Last active October 17, 2023 16:19
Export Mailchimp status in GiveWP
<?php
function export_option_givewp_mc_fields() {
?>
<tr class="give-export-option-fields give-export-option-custom-field">
<td scope="row" class="row-title">
<label><?php esc_html_e( 'MailChimp:', 'give' ); ?></label>
</td>
<td class="give-field-wrap">
<div class="give-clearfix">
@rickalday
rickalday / export_custom_field_no_value.php
Created July 6, 2023 19:07
Export custom fields without a value
function export_option_givewp_field_api_fields() {
?>
<tr class="give-export-option-fields give-export-option-custom-field">
<td scope="row" class="row-title">
<label><?php esc_html_e( 'Custom Field Title:', 'give' ); ?></label>
</td>
<td class="give-field-wrap">
<div class="give-clearfix">
<ul class="give-export-option-custom-fields-ul">
<!-- Custom field checkbox -->
@rickalday
rickalday / stripe-pass-custom-meta-for-payments.php
Created June 29, 2023 23:35
Pass custom field data to Stripe when payment is processed.
<?php
function give_stripe_custom_payment_meta( $charge_args ) {
// Sanitize the input posted data to the form.
$posted_data = give_clean( filter_input_array( INPUT_POST ) );
//Uncomment the followign line to print the $posted_data array to the error log
//error_log(print_r($posted_data, TRUE));
//Get form ID
@rickalday
rickalday / give_include_fund_payment_meta.php
Created June 23, 2023 20:42
Include fund in Stripe payment metadata
<?php
use GiveFunds\Models\Fund;
use GiveFunds\Repositories\Funds;
use GiveFunds\Repositories\Revenue;
function give_include_fund_payment_meta( $charge_args ) {
if ( ! defined( 'GIVE_FUNDS_ADDON_VERSION' )) {
return;
@rickalday
rickalday / custom_salesforce_data.php
Last active September 11, 2023 15:42
Send a bunch of donation metadata to Salesforce
<?php
function addGiveSalesforceDonationArgs(
$args,
\GiveSalesforce\Salesforce\DataTransferObjects\SalesforceOpportunityData $data
) {
// Acknowledgement Status
$args['npsp__Acknowledgment_Status__c'] = "Acknowledged";
@rickalday
rickalday / add_donor_created_date.php
Last active June 7, 2023 18:24
Add Donor Creation Date to Donor Export File
<?php
function give_add_custom_column_to_export_donor( $default_columns ) {
$default_columns['date_created'] = esc_html__( 'Donor Created Date', 'give' );
return $default_columns;
}
add_filter( 'give_export_csv_cols_donors', 'give_add_custom_column_to_export_donor' );
add_filter( 'give_export_donors_get_default_columns', 'give_add_custom_column_to_export_donor' );
@rickalday
rickalday / add_give_transaction_id_tag.php
Created March 27, 2023 18:47
GiveWP Transaction ID Email Tag
<?php
function add_give_transaction_id_tag() {
give_add_email_tag(
array(
'tag' => 'transaction_id', // The tag name.
'desc' => __( 'Outputs the payment gateway transaction ID', 'give' ),
'func' => 'custom_transaction_id_tag', // Callback to function below.
'context' => 'donation', // This tag can be for both admin and donor notifications.
'is_admin' => false, // default is false. This is here to simply display it as an option.
)
@rickalday
rickalday / givewp-export-import-anonymous-field.php
Created March 21, 2023 15:43
Add Anonymous Donation fields in CSV
/**
* Add Anonymous Donation Data fields in export donor fields tab.
*/
function give_anonymous_donation_standard_donor_fields() {
?>
<li>
<label for="give-anonymous-donations">
<input type="checkbox" checked
name="give_give_donations_export_option[give_anonymous_donation]"
id="give_anonymous_donation"><?php _e( 'Anonymous Donation', 'give' ); ?>
<?php
/**
* Adds a CCAvenue Phone Tag: {ccavenue_phone}
* This function creates a custom Give email template tag
*
* @param array $email_tags List of email tags.
*
* @return array
*/