BuddyDev

Search

by Brajesh Singh

Permalink: #679

Fix avatar visibility problem on BuddyPress Multiblog/Multinetwork


function bpdev_fix_avatar_dir_path( $path ){ if ( is_multisite() && BP_ENABLE_MULTIBLOG ) $path = ABSPATH . 'wp-content/uploads/'; return $path; } add_filter( 'bp_core_avatar_upload_path', 'bpdev_fix_avatar_dir_path', 1 ); //fix the upload dir url function bpdev_fix_avatar_dir_url( $url ){ if ( is_multisite() ) $url = network_home_url('/wp-content/uploads') ; return $url; } add_filter( 'bp_core_avatar_url', 'bpdev_fix_avatar_dir_url', 1 );

#bp-hacks #avatar #multinetwork #multisite

by Brajesh Singh

Permalink: #54

Check on the subdirectory install of a multisite for the the current blog using is_blog()

 /**
  * Check if we are on the blog given by the slug
  */
 if( !function_exists( 'is_blog' ) ):
     function is_blog( $slug ){
        if( !$slug )
            return false;

        global  $current_blog;
        global $current_site;

        $sub_path = untrailingslashit( str_replace( $current_site->path, '', $current_blog->path ) );

        if( $sub_path == $slug )
            return true;

        return false;

     }

 endif;

#multisite, #tips You can use this as below to see if the sub blog is current blog like this

if(is_blog('test')){

//yup, we are on the Test blog where test is the slug /blog name

}
Subscribe