Skip to content

Instantly share code, notes, and snippets.

View gspice's full-sized avatar

Ginger Coolidge gspice

  • GSC Solutions LLC
  • Lincoln City, Oregon
View GitHub Profile
@gspice
gspice / export_gift_aid_names.php
Created April 1, 2025 18:30 — forked from rickalday/export_gift_aid_names.php
Export Gift Aid First and Last Names
<?php
add_filter( 'give_gift_aid_export_get_data', static function($data) {
foreach($data as $key => $datakey){
$first_name = give_get_payment_meta($datakey['gift_aid_donation_id'], '_give_donor_billing_first_name', true);
$last_name = give_get_payment_meta($datakey['gift_aid_donation_id'], '_give_donor_billing_last_name', true);
$data[$key]['gift_aid_first_name'] = $first_name;
$data[$key]['gift_aid_last_name'] = $last_name;
}
return $data;
@gspice
gspice / populate_v3_dropdown_from_url.php
Created March 31, 2025 21:04 — forked from rickalday/populate_v3_dropdown_from_url.php
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
@gspice
gspice / make_comment_required.php
Created March 11, 2025 21:46 — forked from rickalday/make_comment_required.php
Make the Commens block field required in GiveWP forms
<?php
add_action('givewp_donation_form_schema', function($form) {
$comment = $form->getNodeByName('comment');
// if the comment field is not found, return
if (!$comment) {
return;
}
// require field
$comment->required(true);
@gspice
gspice / v3-add-referral-url-to-donation-meta.php
Created March 11, 2025 21:34 — forked from rickalday/v3-add-referral-url-to-donation-meta.php
Adds referral URL to donations made on Visual Builder forms
<?php
// Adds a hidden field to the form that stores the URL
add_action('givewp_donation_form_schema', static function (Give\Framework\FieldsAPI\DonationForm $form) {
$field = Give\Framework\FieldsAPI\Hidden::make('referralUrl')
->defaultValue($_SERVER['HTTP_REFERER'])
->emailTag('referralUrl');
$form->insertAfter('email', $field);
});
// (Optional) Use this email tag in the email templates {meta_donation_referralUrl}
@gspice
gspice / 1.php
Created April 4, 2019 20:33 — forked from amdrew/1.php
AffiliateWP - Send the affiliate registration admin email to different email address, or multiple email addresses.
<?php
/**
* Send admin notification to a different email address
*/
function affwp_custom_registration_admin_email( $email ) {
// add the email here
$email = '[email protected]';
return $email;
@gspice
gspice / gist:f90fc70372a74a14fddaabbfcba64d81
Created March 12, 2019 20:13 — forked from pippinsplugins/gist:d973776836ab984aea06
Sets an affiliate user's role to a specific role when being added as an affiliate
<?php
/*
* Plugin name: Affiliate role on registration
*/
function pw_affwp_set_role_on_registration( $affiliate_id = 0 ) {
$user_id = affwp_get_affiliate_user_id( $affiliate_id );
$user = new WP_User( $user_id );
$user->add_role( 'affiliate' );
@gspice
gspice / affwp-pms-restrict-referral.php
Created November 8, 2018 17:34 — forked from tubiz/affwp-pms-restrict-referral.php
Allows you to restrict referral creation to specific PMS subscription plans
<?php
/**
* Plugin Name: AffiliateWP - Restrict Referral Creation To Specific PMS Subscription Plans
* Plugin URI: http://affiliatewp.com
* Description: Allows you to restrict referral creation to specific PMS subscription plans
* Author: Tunbosun Ayinla, tubiz
* Author URI: https://bosun.me
* Version: 1.0
*/
@gspice
gspice / reposition-primary-nav-to-header.php
Created March 9, 2018 23:49
Move primary navigation up to the header
//* Reposition the primary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_header', 'genesis_do_nav', 12 );
@gspice
gspice / replace-widget-element.php
Last active September 18, 2017 04:52
Add this code snippet to your front-page.php file, at the bottom of the utility_pro_homepage_setup() function to swap out any h4 headers for h2.
// Hat tip to Gary Jones (@GaryJ) for providing the explanation
// on what was happening and the code on how to change it.
add_filter( 'genesis_markup_entry-title_open', 'gmj_replace_widget_element' );
add_filter( 'genesis_markup_widget-entry-title_close', 'gmj_replace_widget_element' );
function gmj_replace_widget_element( $string ) {
return str_replace( 'h4', 'h2', $string );
}
@gspice
gspice / home-featured-post-amplified.css
Last active September 18, 2017 04:53
Styling for adding the Genesis Featured Widget Amplified plugin to Utility Pro 1.3.x (personal license)
/* Home Featured Post widget -
using Genesis Featured Widget Amplified
--------------------------------------------- */
.home-featured-posts .featuredpost {
clear: both;
}
.home-featured-posts .featuredpost .widgettitle {
border-top: 1px solid #1c1c1c;
background-color: #fff;