Skip to content

Instantly share code, notes, and snippets.

@rickalday
rickalday / custom_tributes_email_tags.php
Created July 1, 2025 21:22
Custom Tributes Email Tags for the GiveWP Tributes add-on
<?php
add_action( 'give_email_tags', 'register_email_custom_tributes_tags' );
function register_email_custom_tributes_tags($email_tags)
{
$email_tags = array_merge(
$email_tags,
[
[
'tag' => 'honoree_fullname', // The tag name.
@rickalday
rickalday / donor_export_company.php
Created July 1, 2025 01:10
Include Company name in GiveWP Donor Export
<?php
add_filter( 'give_export_donors_get_default_columns', static function($columnData) {
$columnData['donor_company'] = esc_html__( 'Company', 'give' );
return $columnData;
});
use Give\Donors\Models\Donor;
add_filter( 'give_export_get_data_donors', static function($exportData) {
foreach($exportData as $key => $data){
@rickalday
rickalday / give_stripe_custom_payment_meta.php
Created June 4, 2025 19:42
Include fund in Stripe payment metadata - Visual Builder Forms
<?php
use GiveFunds\Models\Fund;
use GiveFunds\Repositories\Funds;
use GiveFunds\Repositories\Revenue;
function give_stripe_custom_payment_meta( $args ) {
// Sanitize the input posted data to the form.
$posted_data = give_clean( filter_input_array( INPUT_POST ) );
@rickalday
rickalday / populate-tributes-from-url.php
Last active May 30, 2025 23:39
Populate Tributes from URL parameters
/**
* EXAMPLE: https://example.com/donations/give-form/?tribute=yes&first=Peter&last=Joseph
**/
add_action( 'givewp_donation_form_enqueue_scripts', function(){
?>
<script>
document.addEventListener("DOMContentLoaded", function () {
// Helper function to get URL parameters
function getUrlParam(param) {
@rickalday
rickalday / wp_give_campaigns.sql
Created April 30, 2025 18:01
SQL command to create GivWP 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,
long_desc TEXT NOT NULL,
campaign_logo TEXT NOT NULL,
Error from migrate_forms_to_campaign_forms:
Migration Failed
Migration ID: migrate_forms_to_campaign_forms
Last run: 2025-04-04 15:10:48
Error details:
Give\Framework\Migrations\Exceptions\DatabaseMigrationException Object
(
[message:protected] => An error occurred while creating initial campaigns
[string:Exception:private] =>
<?php
/**
* This template is used to display the donation grid with [donation_grid]
*/
use Give\Helpers\Form\Template;
use Give\Helpers\Form\Utils as FormUtils;
// Exit if accessed directly.
if (!defined('ABSPATH')) {
@rickalday
rickalday / givewp_export_full_address.php
Created April 3, 2025 19:37
Include full state and country names in GiveWP's Export Donation History
<?php
function givewp_export_full_address( $data, $payment, $columns, $instance ) {
$address = $payment->address;
$data['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : '';
$data['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : '';
$data['address_city'] = isset( $address['city'] ) ? $address['city'] : '';
@rickalday
rickalday / give_export_base_amount.php
Last active April 3, 2025 17:49
Include Base Amount data in Donation History Export Tool
<?php
function give_export_base_amount() {
?>
<li>
<label for="give-export-payment-base_amount">
<input type="checkbox" checked name="give_give_donations_export_option[base_amount]" id="give-export-base_amount"><?php _e( 'Base Amount', 'give' ); ?>
</label>
</li>
<?php
@rickalday
rickalday / populate_v3_dropdown_from_url.php
Created March 31, 2025 19:51
Populate GiveWP v3 form dropdown from URL value
<?php
add_action('givewp_donation_form_schema', function($form) {
//Get field by name attribute
$field = $form->getNodeByName('field_name_here');
// if the field is not found, return
if (!$field) {
return;
}
// get the current default value