Skip to content

Instantly share code, notes, and snippets.

View toluaddy's full-sized avatar
💭
I may be slow to respond.

toluaddy

💭
I may be slow to respond.
View GitHub Profile
@webmasterninjay
webmasterninjay / bp-custom.php
Created January 21, 2020 19:57
Exclude several user roles from buddypress loop
<?php
function exclude_roles_from_members_loop( $retval ) {
if ( bp_is_members_directory() ) {
$exclude_ids = get_users(
array(
'fields' => 'ID',
'role__in' => array( 'editor', 'author' ) // change the roles here
)
);
@JonasSkjodt
JonasSkjodt / bp-change-reply-email.php
Created January 12, 2020 21:19
Change reply to email in Buddypress emails from Wordpress admin email to custom email
<?php
add_filter( 'bp_email_set_reply_to', function( $retval ) {
return new BP_Email_Recipient( '[email protected]' );
} );
@KaineLabs
KaineLabs / yzc_disable_bp_registration.php
Created December 22, 2019 22:35
Disable BuddyPress Registration
<?php
/**
* Disable BuddyPress registration process and fallsback to WordPress' one.
*/
function yzc_disable_bp_registration() {
if ( is_user_logged_in() ) {
return false;
}
@anonymousraft
anonymousraft / functions.php
Created December 16, 2019 03:41
updating specific plugin in wordpress
function auto_update_specific_plugins ( $update, $item ) {
// Array of plugin slugs to always auto-update
$plugins = array (
'akismet',
'buddypress',
);
if ( in_array( $item-&gt;slug, $plugins ) ) {
// Always update plugins in this array
return true;
} else {
<?php
/**
* Require user to have access level to view BuddyPress page
*/
add_filter( 'rcp_member_can_access', function ( $can_access ) {
$access_level = 4;
$page_slug = 'activity';
$customer = rcp_get_customer_by_user_id( get_current_user_id() );
@wptraining
wptraining / bp-custom.php
Created November 22, 2019 02:44
BuddyPress Friends-Only Activity Stream Plugin
function friends_only_activity_args($args)
{
if (!bp_is_activity_directory() || !is_user_logged_in())
{
return $args;
}
$user_id = get_current_user_id();
$user_ids = friends_get_friend_user_ids($user_id);
@KaineLabs
KaineLabs / yzc_activity_state_add_show_everything_filter_actions.php
Created October 29, 2019 23:37
Enable Buddypress Default Status Post Type
<?php
/**
* Activity status
*/
function yzc_activity_state_add_show_everything_filter_actions( $actions ) {
$actions[] = 'activity_status';
return $actions;
}
add_filter( 'yz_wall_show_everything_filter_actions', 'yzc_activity_state_add_show_everything_filter_actions' );
@KaineLabs
KaineLabs / yzc_woffice_theme_fix.php
Created September 26, 2019 23:44
Woffice Theme Fix
<?php
/**
* Woffice Theme Fix.
*/
function yzc_woffice_theme_fix() {
// Get Current Page Path !
$page_path = $_SERVER['REQUEST_URI'];
@imath
imath / bp-custom.php
Created September 13, 2019 04:21
Activate "Activités de publication" for all new page items by default. (Requires https://github.com/imath/activites-de-publication/)
<?php
/**
* For more information about how to use the bp-custom.php file
* @see https://codex.buddypress.org/themes/bp-custom-php/
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
@chetansatasiya
chetansatasiya / functions.php
Created September 9, 2019 09:53
Add Custom Notification
function custom_filter_notifications_get_registered_components( $component_names = array() ) {
// Force $component_names to be an array
if ( ! is_array( $component_names ) ) {
$component_names = array();
}
// Add 'insert_post_comment' component to registered components array
array_push( $component_names, 'insert_post_comment' );