Skip to content

Instantly share code, notes, and snippets.

View sbrajesh's full-sized avatar

Brajesh Singh sbrajesh

View GitHub Profile
<?php
/**
* Plugin Name: BP Group Activities Notifier
* Plugin URI: http://buddydev.com/plugins/bp-group-activities-notifier/
* Author: Brajesh Singh(BuddyDev)
* Author URI: http://buddydev.com/members/sbrajesh/
* Version: 1.0
* Description: Notifies on any action in the group to all group members. I have tested with group join, group post update, forum post/reply. Sould work with others too
*/
@sbrajesh
sbrajesh / hide-user-on-directory.php
Last active August 29, 2015 14:00
Hide Logged in user on BuddyPress directory
add_filter('bp_ajax_querystring', 'devb_hide_user_on_directory', 15, 2);
function devb_hide_user_on_directory( $query_string, $object ){
if( !is_user_logged_in() )
return $query_string;
if( $object != 'members' || isset( $_REQUEST['search_terms'] ) && $_REQUEST['search_terms'] ) //updated to not hide from sarch
return $query_string;
@sbrajesh
sbrajesh / gist:8c6b001dad1983551dac
Created April 24, 2015 08:55
Friends only default privacy
add_filter( 'bpdmp_default_settings', 'bd_friends_only_defult_message_privacy' );
function bd_friends_only_defult_message_privacy( $settings ) {
$settings['privacy_type'] = 'friends_only';
return $settings;
}
@sbrajesh
sbrajesh / gist:088e365ae0b3fb886c43
Created July 21, 2015 00:06
stop buddyblog featured image
<?php
//do not allow featured image pload
add_filter( 'buddyblog_post_form_settings', 'buddydev_restrict_featured_image_upload' );
function buddydev_restrict_featured_image_upload( $settings ) {
$settings['has_post_thumbnail'] = 0;
return $settings;
}
add_filter( 'bpajaxr_is_auto_activation_mode', '__return_false' );
@sbrajesh
sbrajesh / Community activity as Default
Created June 15, 2011 19:36
It will make the community activity sub tab as default activity tab on profile
//fix the nav default
function bpcom_fix_nav(){
global $bp;
if(!bp_is_my_profile())
return;
if ( $bp->current_component == BP_ACTIVITY_SLUG && $bp->current_action=="just-me" ) {
$action=bpcom_get_current_actual_action();
@sbrajesh
sbrajesh / Allow to change the background of profile container div
Created June 19, 2011 22:59
Allow to change the background of profile container div
<?php
add_filter("bppg_iwilldo_it_myself","__return_true");//stop the plugin to inject css
//now we can write our own css
add_action("wp_head","my_css_for_profile_bg");
function my_css_for_profile_bg(){
$image_url=bppg_get_image();
if(!$image_url)
@sbrajesh
sbrajesh / css mod for Jeremy
Created June 28, 2011 16:11
modification of Background css for Jeremy
<?php
add_filter("bppg_iwilldo_it_myself","__return_true");//stop the plugin to inject css
//now we can write our own css
add_action("wp_head","my_css_for_profile_bg");
function my_css_for_profile_bg(){
$image_url=bppg_get_image();
if(!$image_url)
@sbrajesh
sbrajesh / redirect to Profile
Created July 3, 2011 18:37
Redirect to Profile for admin
<?php
/*
Plugin Name: BP Redirect to Profile for Buddypress
Description:Redirect user to their profile when they login
Version: 1.1.1
Requires at least: BuddyPress 1.1
Tested up to: BuddyPress 1.2.8+WordPress 3.1
License: GNU General Public License 2.0 (GPL) http://www.gnu.org/licenses/gpl.html
Author: Brajesh Singh
Author URI: http://buddydev.com
@sbrajesh
sbrajesh / Create activity entry on profile background upload
Created July 6, 2011 08:55
Create activity entry on profile background upload
add_action("bppg_background_uploaded","bppg_record_activity");
function bppg_record_activity( $bg_image ) {
global $bp;
if ( !function_exists( 'bp_activity_add' ) )
return false;
$r = array(
'user_id' => $bp->loggedin_user->id,
'content' =>false ,
'action'=>sprintf("%s changed their profile background",bp_core_get_userlink( $bp->loggedin_user->id )),