Skip to content

Instantly share code, notes, and snippets.

View imath's full-sized avatar
:octocat:
building the Retraceur PHP software!

imath imath

:octocat:
building the Retraceur PHP software!
View GitHub Profile
@imath
imath / tickets.php
Last active January 20, 2026 00:23
Using WP Statuses for custom Post Types.
<?php
/**
* Using WP Statuses for custom Post Types.
*
* @link http://github.com/imath/wp-statuses
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
@imath
imath / wp-content-mu-plugins-index.php
Created August 13, 2025 18:08
Filter hook to enable the Retraceur Cœur 1 click upgrade during 2.0.0 betatests.
<?php
/**
* Filter hook to enable the Retraceur Cœur 1 click upgrade during 2.0.0 betatests.
*
* You can use a `/wp-content/mu-plugins/index.php` file to always run this code into your Retraceur instance.
*/
add_filter( 'retraceur_betatest_direct_updates', '__return_true' );
@imath
imath / mu-plugins-functions.php
Created July 17, 2025 10:18
Retraceur filters & constants to use to bring back some default WP behaviours.
<?php
/**
* Custom functions.
*
* You can use a `/mu-plugins/functions.php` file to always run this code into your Retraceur instance.
*/
// Bring back WP regular registration workflow.
add_filter( 'retraceur_create_account_on_signup', '__return_true' );
@imath
imath / bp-custom.php
Created December 23, 2023 14:24
Disable BuddyPress Signups feature.
<?php
function disable_bp_signups() {
add_filter( 'bp_get_signup_allowed', '__return_false' );
remove_filter( 'register_url', 'bp_get_signup_page' );
remove_action( 'bp_init', 'bp_core_wpsignup_redirect' );
remove_filter( 'wp_signup_location', 'bp_blogs_creation_location' );
remove_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1 );
}
add_action( 'bp_include', 'disable_bp_signups' );
@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 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 / bp-custom.php
Last active August 26, 2023 12:43
Personnalisation du répertoire des membres en fonction du type de membre de l'utilisateur connecté.
<?php
/**
* Créer deux nouveaux types de membre par exemple `gentlemen` et `ladies`.
* Se reporter à cette documentation: https://bpdevel.wordpress.com/2020/09/21/bp-types-admin-ui/
*
* Affecter ces types de membre aux utilisateurs
* Utiliser le code ci-dessous pour personnaliser le répertoire des membres en fonction du type
* de membre de l'utilisateur connecté.
*
* Se reporter à cette documentation pour la mise en place du fichier `bp-custom.php`:
@imath
imath / bp-custom.php
Last active May 30, 2023 19:53
Use an alternative to `bp_core_get_user_displayname()` to get the user's display name without HTML tags when sending a friendship request.
<?php
/**
* Custom function file.
*
* Put a file called `bp-custom.php` into your /wp-content/plugins folder.
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
@imath
imath / imath-pm-friends-only.php
Last active May 3, 2023 06:24
I was writing my second BuddyPress tutorial for wpformation.com when i realized it could be helpful for a community admin to restrict private messages to friends only...
<?php
/*** beginning of the code to paste in your functions.php ***/
function imath_pm_button_only_if_friends( $button ) {
if( is_super_admin() )
return $button;
if( 'is_friend' != friends_check_friendship_status( bp_displayed_user_id(), bp_loggedin_user_id() ) )
return false;
@imath
imath / bp-custom.php
Created April 2, 2023 06:13
Filter to override the BP Attachments private directory
<?php
/**
* BP Attachments overrides.
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}