Skip to content

Instantly share code, notes, and snippets.

View christianwach's full-sized avatar
Thinking time

Christian Wach christianwach

Thinking time
View GitHub Profile
/**
* Clone of wp_debug_backtrace_summary()
*
* Return a comma-separated string of functions that have been called to get
* to the current point in code.
*
* @see https://core.trac.wordpress.org/ticket/19589
*
* @param string $ignore_class Optional. A class to ignore all function calls within - useful
* when you want to just give info about the callee. Default null.
@christianwach
christianwach / mailchimp-bp-reg-options.php
Last active June 22, 2017 12:01
Delay list subscription in MailChimp for WordPress when registration is moderated by BP Registration Options
<?php
/**
* Delay MailChimp subscription when registration is moderated.
*
* Only users who have requested to be signed up to the list will be passed
* to this callback, so store that fact in usermeta for later processing.
*
* @param bool $delay False delays subscription, true does not
* @param int $user_id The user ID to subscribe
<?php /*
--------------------------------------------------------------------------------
Plugin Name: BuddyPress Biography Sync
Description: Keeps a BuddyPress xProfile field in sync with the WordPress user description field.
Author: Christian Wach
Version: 0.1
Author URI: http://haystack.co.uk
--------------------------------------------------------------------------------
*/
@christianwach
christianwach / civicrm-admin-body-classes.php
Last active August 2, 2018 08:55
Adds classes to body element when viewing CiviCRM in WordPress admin.
<?php
add_filter( 'admin_body_class', 'my_admin_body_classes' );
/**
* Adds classes to body element when viewing CiviCRM in WordPress admin.
*
* This allows selectors to be written for CiviCRM admin pages.
*
* @param str $classes The existing admin body classes.
@christianwach
christianwach / civicrm-remove-kam.php
Last active March 13, 2019 16:16
Removes the CiviCRM 5.12.x menu from the front-end in WordPress
<?php /*
--------------------------------------------------------------------------------
Plugin Name: CiviCRM Remove KAM
Description: Removes CiviCRM's menu on the front-end.
Author: Christian Wach
Version: 0.1
Author URI: http://haystack.co.uk
Depends: CiviCRM
--------------------------------------------------------------------------------
*/
@christianwach
christianwach / fix-json-uploads.php
Created January 9, 2020 14:11
Populate file info for JSON files so that they can be uploaded to WordPress.
<?php
/**
* Populate file info for JSON files.
*
* @see https://core.trac.wordpress.org/ticket/45633
*
* @param array $info The existing file data array.
* @param string $file Full path to the file.
* @param string $filename The name of the file.
<?php
/**
* Define CiviCRM Multisite Domain constants and settings.
*
* When a WordPress site is accessed, CiviCRM needs to know a number of settings
* that enable Multisite Domain functionality. Define that data here.
*
* Once the Domain has been created (e.g. via the form on the "Domains" tab of
* the CiviCRM Admin Utilities network settings page) add the corresponding data
@christianwach
christianwach / suppress-admin-notices.php
Last active April 24, 2024 18:33
A WordPress plugin that suppresses nagging admin notices from various plugins.
<?php
/**
* Plugin Name: Suppress Admin Notices
* Plugin URI: https://gist.github.com/christianwach/c30d2972d1807ad9a04dff1db971b7cd
* Description: Stop that damn nagging!
* Version: 1.0.1
* Author: Christian Wach
* Author URI: https://haystack.co.uk
*
* @package CMW_Suppress_Notices
@christianwach
christianwach / order-payment-api-01.txt
Last active May 6, 2021 17:04
Order API & Payment API mismatches
Using CiviCRM Sample Data (where "financial_type_id=5" is a Taxable Financial Type and "financial_type_id=2" is not)
Call Order.create with these params:
[params] => Array
(
[contact_id] => 206
[financial_type_id] => 5 <----- Taxable Financial Type.
[payment_instrument_id] => 4
[trxn_id] => WooCommerce Order - 1859
@christianwach
christianwach / bp-hide-name-field.php
Last active April 5, 2024 20:19
Hides the default Name field on BuddyPress Registration form and Profile Edit screens.
<?php
/**
* Plugin Name: BP Hide Name Field
* Description: Hides the default Name field on BuddyPress Registration form and Profile Edit screens.
* Plugin URI: https://gist.github.com/christianwach/06d878edc277ce1ca8a7e59a82052744
* Version: 1.1
* Author: Christian Wach
* Author URI: https://github.com/christianwach
*/