Ticket #3137: 3137.patch
File 3137.patch, 5.3 KB (added by , 14 years ago) |
---|
-
bp-core/admin/bp-core-admin.php
function bp_core_activation_notice() { 23 23 if ( isset( $_POST['permalink_structure'] ) ) 24 24 return false; 25 25 26 if ( !is_super_admin() ) 27 return false; 28 29 if ( !empty( $wpdb->blogid ) ) { 30 if ( $wpdb->blogid != BP_ROOT_BLOG ) { 31 return false; 32 } 26 if ( empty( $wp_rewrite->permalink_structure ) ) { 27 bp_core_add_admin_notice( sprintf( __( '<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress' ), admin_url( 'options-permalink.php' ) ) ); 33 28 } 34 35 if ( empty( $wp_rewrite->permalink_structure ) ) { ?> 36 37 <div id="message" class="updated fade"> 38 <p><?php printf( __( '<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress' ), admin_url( 'options-permalink.php' ) ) ?></p> 39 </div><?php 40 41 } else { 42 // Get current theme info 43 $ct = current_theme_info(); 44 45 // The best way to remove this notice is to add a "buddypress" tag to 46 // your active theme's CSS header. 47 if ( !defined( 'BP_SILENCE_THEME_NOTICE' ) && !in_array( 'buddypress', (array)$ct->tags ) ) { ?> 48 49 <div id="message" class="updated fade"> 50 <p style="line-height: 150%"><?php printf( __( "<strong>BuddyPress is ready</strong>. You'll need to <a href='%s'>activate a BuddyPress compatible theme</a> to take advantage of all of the features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> or <a href='%s'>update your existing WordPress theme</a>.", 'buddypress' ), network_admin_url( 'themes.php' ), network_admin_url( 'theme-install.php?type=tag&s=buddypress&tab=search' ), network_admin_url( 'plugin-install.php?type=term&tab=search&s=%22bp-template-pack%22' ) ) ?></p> 51 </div> 52 53 <?php 54 } 29 30 // Get current theme info 31 $ct = current_theme_info(); 32 33 // The best way to remove this notice is to add a "buddypress" tag to 34 // your active theme's CSS header. 35 if ( !defined( 'BP_SILENCE_THEME_NOTICE' ) && !in_array( 'buddypress', (array)$ct->tags ) ) { 36 bp_core_add_admin_notice( sprintf( __( "You'll need to <a href='%s'>activate a <strong>BuddyPress-compatible theme</strong></a> to take advantage of all of BuddyPress's features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> or <a href='%s'>update your existing WordPress theme</a>.", 'buddypress' ), admin_url( 'themes.php' ), network_admin_url( 'theme-install.php?type=tag&s=buddypress&tab=search' ), network_admin_url( 'plugin-install.php?type=term&tab=search&s=%22bp-template-pack%22' ) ) ); 55 37 } 56 38 } 57 add_action( 'admin_ notices', 'bp_core_activation_notice' );39 add_action( 'admin_init', 'bp_core_activation_notice' ); 58 40 59 41 /** 60 42 * Renders the main admin panel. -
bp-core/bp-core-functions.php
function bp_core_add_admin_menu() { 160 160 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_core_add_admin_menu', 9 ); 161 161 162 162 /** 163 * Print admin messages to admin_notices or network_admin_notices 164 * 165 * BuddyPress combines all its messages into a single notice, to avoid a preponderance of yellow 166 * boxes. 167 * 168 * @package BuddyPress Core 169 * @since 1.3 170 * 171 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 172 * @uses is_super_admin() to check current user permissions before showing the notices 173 * @uses bp_is_root_blog() 174 */ 175 function bp_core_print_admin_notices() { 176 global $bp; 177 178 // Only the super admin should see messages 179 if ( !is_super_admin() ) 180 return; 181 182 // Sanity check. Non-MS installs should always pass the test; MS installs should go to 183 // Network Admin, which should also always pass the test. 184 if ( !bp_is_root_blog() ) 185 return; 186 187 // Show the messages 188 if ( !empty( $bp->admin->notices ) ) { 189 ?> 190 <div id="message" class="updated fade"> 191 <?php foreach( $bp->admin->notices as $notice ) : ?> 192 <p><?php echo $notice ?></p> 193 <?php endforeach ?> 194 </div> 195 <?php 196 } 197 } 198 add_action( is_multisite() ? 'network_admin_notices' : 'admin_notices', 'bp_core_print_admin_notices' ); 199 200 /** 201 * Add an admin notice to the BP queue 202 * 203 * Messages added with this function are displayed in BuddyPress's general purpose admin notices 204 * box. It is recommended that you hook this function to admin_init, so that your messages are 205 * loaded in time. 206 * 207 * @package BuddyPress Core 208 * @since 1.3 209 * 210 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 211 * @param string $notice The notice you are adding to the queue 212 */ 213 function bp_core_add_admin_notice( $notice ) { 214 global $bp; 215 216 if ( empty( $bp->admin->notices ) ) { 217 $bp->admin->notices = array(); 218 } 219 220 $bp->admin->notices[] = $notice; 221 } 222 223 /** 163 224 * Returns the domain for the root blog. 164 225 * eg: http://domain.com/ OR https://domain.com 165 226 *