Changeset 4183
- Timestamp:
- 04/09/2011 05:32:00 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/admin/bp-core-admin.php
r4175 r4183 359 359 <h3><?php _e( 'Directory Pages', 'buddypress' ); ?></h3> 360 360 361 <p><?php _e( 'Choose a WordPress Page to associate with each BuddyPress component directory. Setting to "None" will render that page inaccessible.', 'buddypress' ); ?></p>361 <p><?php _e( 'Choose a WordPress Page to associate with each BuddyPress component directory. Deactivated components should be set to "None".', 'buddypress' ); ?></p> 362 362 363 363 <table class="form-table"> … … 365 365 366 366 <?php foreach ( $directory_pages as $name => $label ) : ?> 367 368 <?php if ( bp_is_active( $name ) ) : ?> 369 370 <tr valign="top"> 371 <th scope="row"> 372 <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label> 373 </th> 374 375 <td> 376 <?php echo wp_dropdown_pages( array( 377 'name' => 'bp_pages[' . esc_attr( $name ) . ']', 378 'echo' => false, 379 'show_option_none' => __( '- None -', 'buddypress' ), 380 'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false 381 ) ) ?> 382 </td> 383 </tr> 384 385 <?php endif; ?> 386 387 <?php endforeach ?> 388 389 <?php do_action( 'bp_active_external_directories' ); ?> 390 391 </tbody> 392 </table> 393 394 <?php 395 396 // Static pages 397 $static_pages = array( 398 'register' => __( 'Sign up Page', 'buddypress' ), 399 'activate' => __( 'Activation Page', 'buddypress' ), 400 ); ?> 401 402 <h3><?php _e( 'Other Pages', 'buddypress' ); ?></h3> 403 404 <p><?php _e( 'Associate WordPress Pages with the following BuddyPress pages. Setting to "None" will render that page inaccessible.', 'buddypress' ); ?></p> 405 406 <table class="form-table"> 407 <tbody> 408 409 <?php foreach ( $static_pages as $name => $label ) : ?> 410 367 <?php $disabled = !bp_is_active( $name ) ? ' disabled="disabled"' : ''; ?> 368 411 369 <tr valign="top"> 412 370 <th scope="row"> 413 <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?>< /label>371 <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?><?php if ( !bp_is_active( $name ) ) : ?> <span class="description">(deactivated)</span><?php endif ?></label> 414 372 </th> 415 373 … … 424 382 </tr> 425 383 384 385 <?php endforeach ?> 386 387 <?php do_action( 'bp_active_external_directories' ); ?> 388 389 </tbody> 390 </table> 391 392 <?php 393 394 // Static pages 395 $static_pages = array( 396 'register' => __( 'Sign up Page', 'buddypress' ), 397 'activate' => __( 'Activation Page', 'buddypress' ), 398 ); ?> 399 400 <h3><?php _e( 'Other Pages', 'buddypress' ); ?></h3> 401 402 <p><?php _e( 'Associate WordPress Pages with the following BuddyPress pages. Setting to "None" will render that page inaccessible.', 'buddypress' ); ?></p> 403 404 <table class="form-table"> 405 <tbody> 406 407 <?php foreach ( $static_pages as $name => $label ) : ?> 408 409 <tr valign="top"> 410 <th scope="row"> 411 <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label> 412 </th> 413 414 <td> 415 <?php echo wp_dropdown_pages( array( 416 'name' => 'bp_pages[' . esc_attr( $name ) . ']', 417 'echo' => false, 418 'show_option_none' => __( '- None -', 'buddypress' ), 419 'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false 420 ) ) ?> 421 </td> 422 </tr> 423 426 424 <?php endforeach ?> 427 425 -
trunk/bp-core/bp-core-functions.php
r4175 r4183 30 30 * Stores BP pages in the meta table, depending on setup 31 31 * 32 * bp-pages data is stored in the options table of the root blog, except when BP_ENABLE_MULTIBLOG 33 * is turned on. 34 * 32 35 * @package BuddyPress Core 36 * @since 1.3 37 * 38 * @param array $page_ids The IDs of the WP pages corresponding to BP component directories 33 39 */ 34 40 function bp_core_update_page_meta( $page_ids ) { … … 39 45 } 40 46 47 /** 48 * Get bp-pages names and slugs 49 * 50 * @package BuddyPress Core 51 * @since 1.3 52 * 53 * @return obj $pages Page names, IDs, and slugs 54 */ 41 55 function bp_core_get_page_names() { 42 56 global $wpdb, $bp; … … 50 64 $posts_table_name = is_multisite() && !defined( 'BP_ENABLE_MULTIBLOG' ) ? $wpdb->get_blog_prefix( BP_ROOT_BLOG ) . 'posts' : $wpdb->posts; 51 65 $page_ids_sql = implode( ',', (array)$page_ids ); 52 $page_names = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) " ) );66 $page_names = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) AND post_status = 'publish' " ) ); 53 67 54 68 foreach ( (array)$page_ids as $key => $page_id ) { … … 222 236 223 237 /** 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. 238 * Verify that some BP prerequisites are set up properly, and notify the admin if not 239 * 240 * On every Dashboard page, this function checks the following: 241 * - that pretty permalinks are enabled 242 * - that a BP-compatible theme is activated 243 * - that every BP component that needs a WP page for a directory has one 244 * - that no directory WP pages are published for deactivated components 245 * The administrator will be shown a notice for each check that fails. 227 246 * 228 247 * @package BuddyPress Core … … 231 250 global $wp_rewrite, $wpdb, $bp; 232 251 252 // Only the super admin gets warnings 253 if ( !is_super_admin() ) 254 return; 255 256 // On multisite installs, don't log on a non-root blog 257 if ( !bp_is_root_blog() ) 258 return; 259 260 /** 261 * Are pretty permalinks enabled? 262 */ 233 263 if ( isset( $_POST['permalink_structure'] ) ) 234 264 return false; … … 237 267 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 268 } 239 269 270 /** 271 * Are you using a BP-compatible theme? 272 */ 273 240 274 // Get current theme info 241 275 $ct = current_theme_info(); … … 245 279 if ( !defined( 'BP_SILENCE_THEME_NOTICE' ) && !in_array( 'buddypress', (array)$ct->tags ) ) { 246 280 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' ) ) ); 281 } 282 283 /** 284 * Check for orphaned directory pages (BP component is disabled, WP page exists) 285 */ 286 287 $orphaned_pages = array(); 288 foreach( $bp->pages as $component_id => $page ) { 289 290 // Some members of $bp->pages will not have corresponding $bp->{component}, so we 291 // skip them. Plugins can add themselves here if necessary. 292 $exceptions = apply_filters( 'bp_pages_without_components', array( 'register', 'activate' ) ); 293 if ( in_array( $component_id, $exceptions ) ) 294 continue; 295 296 if ( !isset( $bp->{$component_id} ) ) { 297 // We'll need to get some more information about the page for the notice 298 $page_data = get_post( $page->id ); 299 300 $orphaned_pages[] = array( 301 'id' => $page_data->ID, 302 'title' => $page_data->post_title 303 ); 304 } 305 306 } 307 308 // If orphaned pages are found, post a notice about them. 309 if ( !empty( $orphaned_pages ) ) { 310 311 // Create the string of links to the Edit Page screen for the pages 312 $edit_pages_links = array(); 313 foreach( $orphaned_pages as $op ) { 314 $edit_pages_links[] = sprintf( '<a href="%1$s">%2$s</a>', admin_url( 'post.php?action=edit&post=' . $op['id'] ), $op['title'] ); 315 } 316 317 $notice = sprintf( __( 'Some of your WordPress pages are linked to BuddyPress components that have been disabled. These pages may continue to show up in your site navigation. Consider <a href="%1$s">reactivating the components</a>, or unpublishing the pages: <strong>%2$s</strong>', 'buddypress' ), network_admin_url( 'admin.php?page=bp-general-settings' ), implode( ', ', $edit_pages_links ) ); 318 319 bp_core_add_admin_notice( $notice ); 320 } 321 322 /** 323 * Check for orphaned BP components (BP component is enabled, no WP page exists) 324 */ 325 326 $orphaned_components = array(); 327 $wp_page_components = array(); 328 329 // Only some BP components require a WP page to function - those with a non-empty root_slug 330 foreach( $bp->active_components as $component_id => $is_active ) { 331 if ( !empty( $bp->{$component_id}->root_slug ) ) { 332 $wp_page_components[] = array( 333 'id' => $component_id, 334 'name' => $bp->{$component_id}->name 335 ); 336 } 337 } 338 339 // Activate and Register are special cases. They are not components but they need WP pages. 340 // If user registration is disabled, we can skip this step. 341 if ( isset( $bp->site_options['registration'] ) && ( 'user' == $bp->site_options['registration'] || ( 'all' == $bp->site_options['registration'] ) ) ) { 342 $wp_page_components[] = array( 343 'id' => 'activate', 344 'name' => __( 'Activate', 'buddypress' ) 345 ); 346 347 $wp_page_components[] = array( 348 'id' => 'register', 349 'name' => __( 'Register', 'buddypress' ) 350 ); 351 } 352 353 foreach( $wp_page_components as $component ) { 354 if ( !isset( $bp->pages->{$component['id']} ) ) { 355 $orphaned_components[] = $component['name']; 356 } 357 } 358 359 if ( !empty( $orphaned_components ) ) { 360 $notice = sprintf( __( 'Some BuddyPress components must be associated with WordPress pages for your site to work properly. The following components are missing their required WP pages: <strong>%1$s</strong>. Visit the <a href="%2$s">BuddyPress Components</a> panel, where you can either deactivate unused components or complete the page setup.', 'buddypress' ), implode( ', ', $orphaned_components ), network_admin_url( 'admin.php?page=bp-general-settings' ) ); 361 362 bp_core_add_admin_notice( $notice ); 247 363 } 248 364 } -
trunk/bp-friends/bp-friends-loader.php
r4154 r4183 62 62 define( 'BP_FRIENDS_SLUG', $this->id ); 63 63 64 // Global tables for messagingcomponent64 // Global tables for the friends component 65 65 $global_tables = array( 66 66 'table_name' => $bp->table_prefix . 'bp_friends', … … 68 68 ); 69 69 70 // All globals for messagingcomponent.70 // All globals for the friends component. 71 71 // Note that global_tables is included in this array. 72 72 $globals = array( 73 73 'path' => BP_PLUGIN_DIR, 74 74 'slug' => BP_FRIENDS_SLUG, 75 'root_slug' => isset( $bp->pages->friends->slug ) ? $bp->pages->friends->slug : BP_FRIENDS_SLUG,76 75 'search_string' => __( 'Search Friends...', 'buddypress' ), 77 76 'notification_callback' => 'friends_format_notifications', -
trunk/bp-messages/bp-messages-loader.php
r4157 r4183 71 71 $globals = array( 72 72 'slug' => BP_MESSAGES_SLUG, 73 'root_slug' => isset( $bp->pages->messages->slug ) ? $bp->pages->messages->slug : BP_MESSAGES_SLUG,74 73 'notification_callback' => 'messages_format_notifications', 75 74 'search_string' => __( 'Search Messages...', 'buddypress' ), -
trunk/bp-settings/bp-settings-loader.php
r4154 r4183 49 49 define( 'BP_SETTINGS_SLUG', $this->id ); 50 50 51 // All globals for messaging component. 52 // Note that global_tables is included in this array. 51 // All globals for settings component. 53 52 $globals = array( 54 53 'slug' => BP_SETTINGS_SLUG, 55 'root_slug' => isset( $bp->pages->settings->slug ) ? $bp->pages->settings->slug : BP_SETTINGS_SLUG,56 54 ); 57 55
Note: See TracChangeset
for help on using the changeset viewer.