Skip to content

Instantly share code, notes, and snippets.

View imath's full-sized avatar
:octocat:
Moving to something new!

imath imath

:octocat:
Moving to something new!
View GitHub Profile
@imath
imath / bp-custom.php
Created July 28, 2014 16:14
BuddyPress members directory : Filtrer selon meta_key/value ou trier selon meta_key
<?php
/**
* Tu peux tester en créant un fichier bp-custom.php dans ton répertoire plugins
* @see http://codex.buddypress.org/plugindev/bp-custom-php/
*/
/******************************************************************
* 1/ filter par rapport à un couple meta_key/meta_value
@imath
imath / functions.php
Created July 30, 2014 09:26
MesoColumn Theme & BuddyDrive : fixing user nav css issue
<?php
/**
* Override BuddyDrive default css by filtering buddydrive_global_css
*
* The array to return needs to be like :
*
* array(
* 'stylesheet_uri' => url to the new css file
* 'deps' => array of registered css dependencies
* )
@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..
@imath
imath / bp-custom.php
Created August 31, 2014 10:28
Restrict the use of BuddyDrive to a minimum capability
<?php
function restrict_to_a_role() {
if ( ! bp_is_user() || buddydrive_get_slug() != bp_current_component() ) {
return;
}
// Change 'bp_moderate' with the capability of your choice
if ( ! bp_current_user_can( 'bp_moderate' ) ) {
// Remove actions
@imath
imath / bp-custom.php
Created September 18, 2014 22:26
add BuddyPress auto suggest mention feature in bbPress.
<?php
/** You could put this in the bp-custom.php file
* @see http://codex.buddypress.org/themes/bp-custom-php/
*/
function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) {
if ( function_exists( 'bbpress' ) && is_bbpress() ) {
$retval = true;
}
return $retval;
@imath
imath / wp-idea-stream-custom.php
Created September 30, 2014 11:52
Example of actions and filters to use to customize the behavior of WP Idea Stream
<?php
/**
* WP Idea Stream Custom.
*
* Place here the function to customize Version 2.0+ of WP Idea Stream
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
@imath
imath / wp-idea-stream-custom.php
Created October 3, 2014 12:34
Neutralize hashbuddy filter.
<?php
/**
* Name me as wp-idea-stream-custom.php
* and put me in /wp-content/plugins/
*/
function qobalt_remove_hashbuddy_filter() {
if ( ! wp_idea_stream_is_single_idea() ) {
return;
}
@imath
imath / functions.php
Created November 1, 2014 16:12
Add a custom support status to Buddy-bbPress Support topic.
<?php
/**
* Filter the available status to add a custom one
*
* Requires buddy-bbpress-support topic plugin
* bbPress 2.5+
* WordPress 4.0
*
* @param array $allstatus the available status
@imath
imath / bp-custom.php
Created January 29, 2015 19:06
Code Snippet to put in your bp-custom.php file to be able to filter the BuddyPress members directory by member types (requires BuddyPress version 2.2-beta1)
<?php
/**
* Using BuddyPress Member types API
*
* see codex: https://codex.buddypress.org/developer/member-types/
*
* Required config:
* - WordPress 4.1
* - BuddyPress 2.2
*
@imath
imath / bp-custom.php
Created February 5, 2015 17:36
Temporarly fix to BuddyPress Links when used with BuddyPress 2.2.
<?php
/**
* This is temparary, please advise the plugin author to use the BP_Component Class
* @see https://github.com/boonebgorges/buddypress-skeleton-component/blob/1.7/includes/bp-example-loader.php
*/
function buddypress_links_temporary_fix( $retval, $component = '' ) {
if ( 'links' != $component ) {