Skip to content

Instantly share code, notes, and snippets.

Avatar
Thinking time

Christian Wach christianwach

Thinking time
View GitHub Profile
@christianwach
christianwach / suppress-notices.php
Last active Jun 8, 2021
A WordPress plugin that suppresses admin notices.
View suppress-notices.php
<?php /*
--------------------------------------------------------------------------------
Plugin Name: Suppress Admin Notices
Plugin URI: https://github.com/christianwach
Description: Stop that damn nagging!
Author: Christian Wach
Version: 0.1
Author URI: http://haystack.co.uk
--------------------------------------------------------------------------------
*/
@christianwach
christianwach / bp-hide-name-field.php
Last active May 27, 2021
Hides the default Name field on BuddyPress Registration form.
View bp-hide-name-field.php
<?php
/**
* Plugin Name: BP Hide Name Field
* Description: Hides the default Name field on BuddyPress Registration form.
* Author: Christian Wach
* Author URI: https://github.com/christianwach
* Version: 1.0
*/
add_filter( 'bp_after_has_profile_parse_args', 'bphnf_intercept_profile_query_args' );
@christianwach
christianwach / order-payment-api-01.txt
Last active May 6, 2021
Order API & Payment API mismatches
View order-payment-api-01.txt
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
View civicrm-multisite-domain-config.php
<?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
View buddypress-biography-sync.php
<?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 / fix-json-uploads.php
Created Jan 9, 2020
Populate file info for JSON files so that they can be uploaded to WordPress.
View fix-json-uploads.php
<?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.
@christianwach
christianwach / civicrm-remove-kam.php
Last active Mar 13, 2019
Removes the CiviCRM 5.12.x menu from the front-end in WordPress
View civicrm-remove-kam.php
<?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 / civicrm-admin-body-classes.php
Last active Aug 2, 2018
Adds classes to body element when viewing CiviCRM in WordPress admin.
View civicrm-admin-body-classes.php
<?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 / mailchimp-bp-reg-options.php
Last active Jun 22, 2017
Delay list subscription in MailChimp for WordPress when registration is moderated by BP Registration Options
View mailchimp-bp-reg-options.php
<?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
@christianwach
christianwach / civicrm-modifier.php
Last active Nov 23, 2016
Basic CiviCRM Modification
View civicrm-modifier.php
<?php /*
--------------------------------------------------------------------------------
Plugin Name: CiviCRM Modifier
Plugin URI: http://haystack.co.uk
Description: Custom code to modify CiviCRM's behaviour in a multisite context
Author: Christian Wach
Version: 0.1
Author URI: http://haystack.co.uk
--------------------------------------------------------------------------------
*/