Skip to content

Instantly share code, notes, and snippets.

View modemlooper's full-sized avatar
🏠
Working from home

mödemlooper modemlooper

🏠
Working from home
View GitHub Profile
@boonebgorges
boonebgorges / gist:8301715
Last active January 2, 2016 12:09
A filter to force BuddyPress's group search to work on a word-wise basis, instead of on exact matches using multiple words. In other words: out of the box, searching for "American History" will not return a group called "American Military History"; after this change, it will.
<?php
/**
* Modify BuddyPress group search to work on a word-wise basis
*/
function openlab_group_search_breakup( $sql, $s ) {
global $bp;
if ( ! empty( $s['search'] ) ) {
// Get the search terms
@imath
imath / bp-custom.php
Created August 14, 2014 13:18
This a snippet to auto join "just activated" members in one or more BuddyPress groups.
<?php
if ( ! class_exists( 'Imath_Auto_Join_Groups' ) ) :
/**
* AutoJoin new members to chosen groups
*
* This is a little snippet, feel free to :
* - use it
* - extend it..
<?php
add_filter( 'json_query_vars', function( $valid_vars ) {
$valid_vars = array_merge( $valid_vars, array( 'meta_key', 'meta_value' ) );
return $valid_vars;
});
@rogerlos
rogerlos / searchwp_results_substitute_post_for_attachment.php
Created November 11, 2014 23:49
Wordpress SearchWP: Substitute Post for Attachment in Search Results
<?php
/**
* This function will see if a PDF or other "attachment" post-type returned by SearchWP
* is present in a custom field in a regular post, and will return that post instead. Note
* this will only process documents which are referenced via the "attachment" post type.
*
* For example, you may have a product specification PDF and would like it in the search
* results, but would rather people got to it by visiting the product page itself.
*
@jchristopher
jchristopher / gist:fc1d461bd82b40e31290
Last active August 30, 2019 18:45
Tell SearchWP to extract PDF contents of a file uploaded to an ACF file upload field and store that content with the post itself as custom metadata, not the Media entry
<?php
/**
* Extract PDF content from a file uploaded via ACF File field (where
* the actual data stored is only the Media ID) and store PDF
* content as SearchWP 'extra' metadata so it can be included in
* searches and attributed to the post itself, not the Media entry
*/
class My_SearchWP_Customizations {
@bnagy
bnagy / gpgmutt.md
Last active July 21, 2025 11:06
Mutt, Gmail and GPG

GPG / Mutt / Gmail

About

This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.

Here is an incomplete list of things that are different from other approaches:

  • I don't use keyservers. Ever.
  • Yes, I use Gmail instead of some bespoke hipster freedom service
@djabif
djabif / dynamicAnchorFix.js
Last active March 18, 2017 09:27
Directive to open external links in Ionic App using inAppBrowser cordova plugin
//Use this directive to open external links using inAppBrowser cordova plugin
.directive('dynamicAnchorFix', function($ionicGesture, $timeout, $cordovaInAppBrowser) {
return {
scope: {},
link: function(scope, element, attrs) {
$timeout(function(){
var anchors = element.find('a');
if(anchors.length > 0)
{
angular.forEach(anchors, function(a) {
@JRGould
JRGould / wp-migrate-db-pro-tweaks.php
Created August 5, 2015 19:19
WP Migrate DB Pro Tweaks - edited to allow utf8mb4 to utf8 migrations
<?php
/*
Plugin Name: WP Migrate DB Pro Tweaks
Plugin URI: http://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
Description: Examples of using WP Migrate DB Pro's filters
Author: Delicious Brains
Version: 0.1
Author URI: http://deliciousbrains.com
*/
angular.module('sfViewCtrlDirective', [])
.directive('open', OpenDirective);
function OpenDirective() {
return {
restrict: 'A',
link: function($scope, $element, $attr) {
console.log('device is ready');
$element.on('click', function() {
@jazzsequence
jazzsequence / update-forum-groupmeta.php
Last active April 19, 2016 19:20
Updates the group meta for forum id based on updated forum ids.
<?php
/*
Plugin Name: WDS CLP Update Forum Group Meta Script
Description: Updates the group meta for forum id based on updated forum ids.
Author: WebDevStudios
Author URI: http://webdevstudios.com
Version: 1.0
License: GPL2
*/