Changeset 4175
- Timestamp:
- 04/08/2011 09:29:34 PM (14 years ago)
- Location:
- trunk/bp-core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/admin/bp-core-admin.php
r4107 r4175 10 10 } 11 11 add_action( 'in_plugin_update_message-buddypress/bp-loader.php', 'bp_core_update_message' ); 12 13 /**14 * When BuddyPress is activated we must make sure that mod_rewrite is enabled.15 * We must also make sure a BuddyPress compatible theme is enabled. This function16 * will show helpful messages to the administrator.17 *18 * @package BuddyPress Core19 */20 function bp_core_activation_notice() {21 global $wp_rewrite, $wpdb, $bp;22 23 if ( isset( $_POST['permalink_structure'] ) )24 return false;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 }33 }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><?php40 41 } else {42 // Get current theme info43 $ct = current_theme_info();44 45 // The best way to remove this notice is to add a "buddypress" tag to46 // 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 <?php54 }55 }56 }57 add_action( 'admin_notices', 'bp_core_activation_notice' );58 12 59 13 /** -
trunk/bp-core/bp-core-functions.php
r4174 r4175 159 159 } 160 160 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_core_add_admin_menu', 9 ); 161 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 // On multisite installs, don't show on the Site Admin of a non-root blog 183 if ( !bp_is_root_blog() ) 184 return; 185 186 // Show the messages 187 if ( !empty( $bp->admin->notices ) ) { 188 ?> 189 <div id="message" class="updated fade"> 190 <?php foreach( $bp->admin->notices as $notice ) : ?> 191 <p><?php echo $notice ?></p> 192 <?php endforeach ?> 193 </div> 194 <?php 195 } 196 } 197 add_action( 'admin_notices', 'bp_core_print_admin_notices' ); 198 add_action( 'network_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 /** 224 * When BuddyPress is activated we must make sure that mod_rewrite is enabled. 225 * We must also make sure a BuddyPress compatible theme is enabled. This function 226 * will show helpful messages to the administrator. 227 * 228 * @package BuddyPress Core 229 */ 230 function bp_core_activation_notice() { 231 global $wp_rewrite, $wpdb, $bp; 232 233 if ( isset( $_POST['permalink_structure'] ) ) 234 return false; 235 236 if ( empty( $wp_rewrite->permalink_structure ) ) { 237 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' ) ) ); 238 } 239 240 // Get current theme info 241 $ct = current_theme_info(); 242 243 // The best way to remove this notice is to add a "buddypress" tag to 244 // your active theme's CSS header. 245 if ( !defined( 'BP_SILENCE_THEME_NOTICE' ) && !in_array( 'buddypress', (array)$ct->tags ) ) { 246 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' ) ) ); 247 } 248 } 249 add_action( 'admin_init', 'bp_core_activation_notice' ); 161 250 162 251 /**
Note: See TracChangeset
for help on using the changeset viewer.