Skip to content

Instantly share code, notes, and snippets.

View sbrajesh's full-sized avatar

Brajesh Singh sbrajesh

View GitHub Profile
@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;
}
@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 / 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;
<?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-admins-subscribers.php
Created July 1, 2013 20:28
hide admins and subscribers
add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
function bpdev_exclude_users($qs=false,$object=false){
//list of users to exclude
$excluded_user=join(',', bpdev_get_subscriber_admin_user_ids());//comma separated ids of users whom you want to exclude
if($object!='members')//hide for members only
return $qs;
<?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 / bp-activity-wire-functions.php
Last active December 13, 2015 17:39
BuddyPress Activity as wire
add_action('init', 'bdev_fix_activity_posting_hooks');
function bdev_fix_activity_posting_hooks() {
remove_action('wp_ajax_post_update', 'bp_dtheme_post_update');
}
//add our own handler for activity posting
add_action('wp_ajax_post_update', 'bp_mytheme_post_update');
@sbrajesh
sbrajesh / filter-wp-fb-connect-uid
Created January 14, 2013 23:25
Use facebook uid saved by wp-fb-autoconnect with fbplus
add_filter('get_user_metadata','fbplus_filter_wpfb_id',10,4);
function fbplus_filter_wpfb_id($val, $object_id, $meta_key, $single){
if($meta_key!='fb_account_id')
return $val;
//if meta key is fb_account_id, we will need to fetchand see if there exists a facebook_uid
$val=get_user_meta($object_id,'facebook_uid',$single);
if(empty($val))
$val=null;
@sbrajesh
sbrajesh / global-search-in-wp-adminbar.php
Created September 24, 2012 20:39
Use wordpress adminbar search form for global search
function remove_wp_adminbar_search_menu(){
//remove the search from from adminbar menu
remove_action('admin_bar_menu', 'wp_admin_bar_search_menu', 4 );
}
add_action('init','remove_wp_adminbar_search_menu');
function custom_admin_bar_search_menu( $wp_admin_bar ) {
if ( is_admin() )
return;
@sbrajesh
sbrajesh / personal-activity-default-on-activity-dir.diff
Created September 21, 2012 00:04
personal-activity-default-on-activity-dir
diff --git a/bp-themes/bp-default/_inc/global.js b/bp-themes/bp-default/_inc/global.js
index 9efbd71..fa8ecc8 100644
--- a/bp-themes/bp-default/_inc/global.js
+++ b/bp-themes/bp-default/_inc/global.js
@@ -1261,7 +1261,7 @@ function bp_filter_request( object, filter, scope, target, search_terms, page, e
search_terms = jq.query.get('s');
if ( null == scope )
- scope = 'all';
+ scope = 'personal';