Skip to content

Instantly share code, notes, and snippets.

@christianwach
christianwach / acfe-latest-acf-fix.php
Last active November 7, 2024 15:22
Temporary fix for AJAX selectors in ACF 6.3.10
<?php
/**
* ACFE Fix AJAX selectors
*
* Plugin Name: ACFE Fix AJAX selectors
* Description: Fixes AJAX selectors with ACF 6.3.10. Do not deacticate or delete.
* Plugin URI: https://haystack.co.uk
* Version: 1.0.0
* Author: Christian Wach
* Author URI: https://haystack.co.uk
@christianwach
christianwach / bp-hide-name-field.php
Last active February 10, 2025 08:33
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
*/
@christianwach
christianwach / suppress-admin-notices.php
Last active February 11, 2025 12:27
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.2
* Author: Christian Wach
* Author URI: https://haystack.co.uk
*
* @package CMW_Suppress_Admin_Notices
@ipokkel
ipokkel / pmpro-restrict-all-cpt-posts.php
Last active April 7, 2025 08:51
Restrict all posts for a custom post type (CPT) automatically with PMPro but allow administrators access to the CPT #cpt #pmpro-cpt
<?php
/**
* This recipe restricts all content of a Custom Post Type (CPT)
* to members only.
*
* This recipe assumes your CPT name is "recipes".
* You should replace this with your CPT name for the filter name
* and the $my_cpt variable's value in the hook name on line 71,
* e.g. pmpro_has_membership_access_filter_cpt-name,
* and 74, e.g. $my_cpt = 'cpt-name'.
<?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
@tessak22
tessak22 / functions.php
Created March 12, 2019 12:06
Hero Gutenberg Block using Advanced Custom Fields 5.8 Pro
/**
* Register hero block
*/
add_action('acf/init', 'hero');
function hero() {
// check function exists
if( function_exists('acf_register_block') ) {
// register a hero block
@xurizaemon
xurizaemon / strip-triggers.sh
Created March 16, 2017 18:57
MySQL - strip trigger owners from a .sql dump
perl -pi -e 's#\/\*\!5001[7|3].*?`[^\*]*\*\/##g' dumpfile.sql
@colemanw
colemanw / gitpr
Last active October 14, 2016 13:10
GitPR script
#!/bin/bash
# start at top directory if we're not already there
pushd "$(git rev-parse --show-toplevel)" > /dev/null
# run style checker
civilint
if [[ $? == 1 ]]
then
echo "PR aborted"

CiviCRM Hooks in Drupal

civicrm_permission()

This hook can supply permissions that the module defines, so that they can be selected on the user permissions page and used to grant or restrict access to actions the module performs. - * documentation

Retrieves permissions from `CRM_Core_Permission::basicPermissions()`` and returns array to Drupal.

civicrm_block_info()

@salcode
salcode / .gitignore
Last active February 19, 2025 22:44
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.