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
@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
@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 /*
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
*/
<?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 / 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

Why am I seeing this?

The BP xProfile WordPress User Sync plugin is no longer needed because the "First Name" and "Last Name" xProfile Fields that it provides have been added to BuddyPress 8.0.0. In addition to this, BuddyPress itself now handles syncing the data with the built-in WordPress User fields. For more information about this transition, please visit the BuddyPress Dev Update page.

What needs to be done?

Before you go ahead and deactivate and delete the BP xProfile WordPress User Sync plugin, there are few things that need to be checked to make sure your site continues to work the way it did before.

Filters and Actions

@christianwach
christianwach / bp-xprofile-functions.php
Last active October 19, 2021 08:49
Patched xprofile_sync_wp_profile() for BuddyPress 9.2+
<?php
/**
* Syncs Xprofile data to the standard built in WordPress profile data.
*
* @since 1.0.0
* @since 9.2.0 Adds the $args arguments to catch hook's additional arguments.
*
* @param int $user_id ID of the user to sync.
* @param array $args Hook's additional arguments.
<?php
/**
* Plugin Name: Multisite: Passwort Reset on Local Blog
* Plugin URI: https://gist.github.com/eteubert/293e07a49f56f300ddbb
* Description: By default, WordPress Multisite uses the main blog for passwort resets. This plugin enables users to stay in their blog during the whole reset process.
* Version: 1.0.0
* Author: Eric Teubert
* Author URI: http://ericteubert.de
* License: MIT
*/