Skip to content

Instantly share code, notes, and snippets.

View sbrajesh's full-sized avatar

Brajesh Singh sbrajesh

View GitHub Profile
@sbrajesh
sbrajesh / mpp-bp-reshare.php
Created May 30, 2017 13:16
MediaPress media support for BP reshare plugin
// For reshare, add mpp_media_upload type.
add_filter( 'buddyreshare_activity_types', function( $types ) {
$types[] = 'mpp_media_upload';
return $types;
});
// Filter the action string for the shared media activity
add_filter( 'buddyreshare_prepare_reshare_activity', function( $action_string, $activity ) {
if ( 'mpp_media_upload' !== $activity->type ) {
@sbrajesh
sbrajesh / mpp-display-gallery-media-owner-name.php
Created January 28, 2017 05:57
Add the gallery creator and media uploaders name to mediapress gallery/media.
@sbrajesh
sbrajesh / copy-png-files.php
Created August 17, 2016 10:16
Copy png files from the directory recursively to the destination directory
<?php
/** Copy PNG files from the Source Directory( and its child directories) to destination as specified
*
* I use it to move all the png files from the extracted subtle patterns directories to another directory
*
* @param string $path the directory which contains our subdirectories
* @param string $destination_dir the absolute path to directory where files will be moved
*/
function copy_png_files( $path, $destination_dir ) {
@sbrajesh
sbrajesh / jaume-group-open-close.php
Created July 27, 2016 19:37
group open close example for Jaume
//do not let the activity be posted by any means(do not allow from directory etc)
function bd_check_post_update() {
$item_id = 0;
$object = '';
//Do not notify for join group activity in BP Local group Activity notifier
function buddydev_do_not_notify_join_group_activity( $stop_notification, $activity ) {
if ( $activity->type == 'joined_group' ) {
$stop_notification = true;
}
return $stop_notification;
}
add_filter( 'bp_local_group_notifier_skip_notification', 'buddydev_do_not_notify_join_group_activity', 10, 2 );
function buddydev_skip_group_join_notification( $skip, $activity ) {
if ( $activity->type == 'joined_group' ) {
$skip = true;
}
return $skip;
}
add_filter( 'bp_local_group_notifier_skip_notification', 'buddydev_skip_group_join_notification', 10, 2 );
function buddydev_ua_enable_everwhere( $load ) {
if ( ! is_user_logged_in() ) {
$load = true;
}
return $load;
}
add_filter( 'buddydev_username_availability_checker_load_assets', 'buddydev_ua_enable_everwhere');
function buddydev_ua_custom_selector( $selectors ) {
//Blog Categories for Groups, auto category creation and association
function bcg_custom_create_group_name_category( $group_id, $group ) {
bcg_custom_create_group_category( $group );
}
add_action( 'groups_created_group', 'bcg_custom_create_group_name_category', 10, 2 );
//modify extensions to hide the create/manage screen
add_filter( 'bpajaxr_is_auto_activation_mode', '__return_false' );