Ticket #6592: 6592-register-post-type-on-rootblog-only.patch
| File 6592-register-post-type-on-rootblog-only.patch, 3.2 KB (added by , 10 years ago) |
|---|
-
src/bp-core/bp-core-admin.php
diff --git src/bp-core/bp-core-admin.php src/bp-core/bp-core-admin.php index 3a7a76d..5b34019 100644
class BP_Admin { 143 143 // Add menu item to settings menu. 144 144 add_action( bp_core_admin_hook(), array( $this, 'admin_menus' ), 5 ); 145 145 146 // Add Menu for the Customizer Email 147 add_action( 'admin_menu', array( $this, 'customizer_menu' ) ); 148 146 149 // Enqueue all admin JS and CSS. 147 150 add_action( 'bp_admin_enqueue_scripts', array( $this, 'admin_register_styles' ), 1 ); 148 151 add_action( 'bp_admin_enqueue_scripts', array( $this, 'admin_register_scripts' ), 1 ); … … class BP_Admin { 299 302 'bp_core_admin_tools' 300 303 ); 301 304 302 $hooks[] = add_theme_page( 305 foreach( $hooks as $hook ) { 306 add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' ); 307 } 308 } 309 310 /** 311 * Add the navigational elements for the customizer 312 * 313 * @since 2.5.0 314 */ 315 public function customizer_menu() { 316 // Only add the customizer menu for the root blog 317 if ( ! bp_is_root_blog() ) { 318 return; 319 } 320 321 // Emails 322 add_theme_page( 303 323 _x( 'Emails', 'screen heading', 'buddypress' ), 304 324 _x( 'Emails', 'screen heading', 'buddypress' ), 305 325 $this->capability, 306 326 'bp-emails-customizer-redirect', 307 327 'bp_email_redirect_to_customizer' 308 328 ); 309 310 foreach( $hooks as $hook ) {311 add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );312 }313 329 } 314 330 315 331 /** -
src/bp-core/bp-core-loader.php
diff --git src/bp-core/bp-core-loader.php src/bp-core/bp-core-loader.php index 5500e0c..8ce52c7 100644
class BP_Core extends BP_Component { 292 292 * @since BuddyPress (2.4.0) 293 293 */ 294 294 public function register_post_types() { 295 296 // Emails 297 register_post_type( 298 bp_get_email_post_type(), 299 apply_filters( 'bp_register_email_post_type', array( 300 'description' => _x( 'BuddyPress emails', 'email post type description', 'buddypress' ), 301 'labels' => bp_get_email_post_type_labels(), 302 'menu_icon' => 'dashicons-email', 303 'public' => false, 304 'publicly_queryable' => bp_current_user_can( 'bp_moderate' ), 305 'query_var' => false, 306 'rewrite' => false, 307 'show_in_admin_bar' => false, 308 'show_ui' => bp_current_user_can( 'bp_moderate' ), 309 'supports' => bp_get_email_post_type_supports(), 310 ) ) 311 ); 295 // Make sure BuddyPress Post Types are only registered for the root blog 296 if ( bp_is_root_blog() ) { 297 // Emails 298 register_post_type( 299 bp_get_email_post_type(), 300 apply_filters( 'bp_register_email_post_type', array( 301 'description' => _x( 'BuddyPress emails', 'email post type description', 'buddypress' ), 302 'labels' => bp_get_email_post_type_labels(), 303 'menu_icon' => 'dashicons-email', 304 'public' => false, 305 'publicly_queryable' => bp_current_user_can( 'bp_moderate' ), 306 'query_var' => false, 307 'rewrite' => false, 308 'show_in_admin_bar' => false, 309 'show_ui' => bp_current_user_can( 'bp_moderate' ), 310 'supports' => bp_get_email_post_type_supports(), 311 ) ) 312 ); 313 } 312 314 313 315 parent::register_post_types(); 314 316 }