Skip to content

Instantly share code, notes, and snippets.

@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
*/
@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
@ipokkel
ipokkel / pmpro-restrict-all-cpt-posts.php
Last active March 28, 2024 16:48
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 "recipe".
* You should replace this with your CPT name for the filter name
* and the $my_cpt variable's value.
*
* You can add this recipe to your site by creating a custom plugin
<?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 July 10, 2024 14:28
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.
@iandunn
iandunn / camptix-gravatar-badges.php
Last active August 5, 2022 14:26
CampTix Attendee Badges with Gravatars
<?php
/*
* Generate a CSV for InDesign with attendee info and Gravatars
*
* See http://plan.wordcamp.org/helpful-documents-and-templates/create-wordcamp-badges-with-gravatars/ for instructions
*
* input is a CSV export of CampTix attendees. Format is: "First Name","Last Name","E-mail Address","Twitter Username"
* the script downloads the attendee's Gravatars, and adds a column to the CSV with the filename of the image
* the CSV can then be used by InDesign to generate wordcamp badges with the attendee's gravatar