Changeset 6581
- Timestamp:
- 12/10/2012 08:25:00 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/admin/bp-core-components.php
r6558 r6581 50 50 function bp_core_admin_components_options() { 51 51 52 // Load core functions, if needed53 if ( !function_exists( 'bp_get_option' ) )54 require( BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php' );55 56 52 // Declare local variables 57 53 $deactivated_components = array(); … … 78 74 ); 79 75 76 // Retired components 77 $retired_components['forums'] = array( 78 'title' => __( 'Group Forums', 'buddypress' ), 79 'description' => sprintf( __( 'BuddyPress Forums are retired. Use %s.', 'buddypress' ), '<a href="http://bbpress.org">bbPress</a>' ) 80 ); 81 80 82 // Optional core components 81 83 $optional_components = array( … … 105 107 ), 106 108 'forums' => array( 107 'title' => __( ' Discussion Forums', 'buddypress' ),108 'description' => __( ' Site-wide and Group forums allow for focused, bulletin-board style conversations. Powered by bbPress.', 'buddypress' )109 'title' => __( 'Group Forums (Legacy)', 'buddypress' ), 110 'description' => __( 'Group forums allow for focused, bulletin-board style conversations.', 'buddypress' ) 109 111 ), 110 112 'blogs' => array( … … 114 116 ); 115 117 118 // Don't show Forums component in optional components if it's disabled 119 if ( ! bp_is_active( 'forums' ) ) { 120 unset( $optional_components['forums'] ); 121 } 122 116 123 // Add blogs tracking if multisite 117 124 if ( is_multisite() ) { … … 130 137 // Trim off namespace and filename 131 138 $trimmed = array(); 132 foreach ( (array) $deactivated_components as $component => $value) {139 foreach ( array_keys( (array) $deactivated_components ) as $component ) { 133 140 $trimmed[] = str_replace( '.php', '', str_replace( 'bp-', '', $component ) ); 134 141 } 135 142 136 143 // Loop through the optional components to create an active component array 137 foreach ( (array) $optional_components as $ocomponent => $ovalue) {144 foreach ( array_keys( (array) $optional_components ) as $ocomponent ) { 138 145 if ( !in_array( $ocomponent, $trimmed ) ) { 139 146 $active_components[$ocomponent] = 1; … … 176 183 $current_components = $required_components; 177 184 break; 185 case 'retired' : 186 $current_components = $retired_components; 187 break; 178 188 } ?> 179 189 … … 182 192 <li><a href="<?php echo add_query_arg( array( 'page' => 'bp-components', 'action' => 'active' ), bp_get_admin_url( $page ) ); ?>" <?php if ( $action === 'active' ) : ?>class="current"<?php endif; ?>><?php printf( _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', count( $active_components ), 'buddypress' ), number_format_i18n( count( $active_components ) ) ); ?></a> | </li> 183 193 <li><a href="<?php echo add_query_arg( array( 'page' => 'bp-components', 'action' => 'inactive' ), bp_get_admin_url( $page ) ); ?>" <?php if ( $action === 'inactive' ) : ?>class="current"<?php endif; ?>><?php printf( _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', count( $inactive_components ), 'buddypress' ), number_format_i18n( count( $inactive_components ) ) ); ?></a> | </li> 184 <li><a href="<?php echo add_query_arg( array( 'page' => 'bp-components', 'action' => 'mustuse' ), bp_get_admin_url( $page ) ); ?>" <?php if ( $action === 'mustuse' ) : ?>class="current"<?php endif; ?>><?php printf( _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', count( $required_components ), 'buddypress' ), number_format_i18n( count( $required_components ) ) ); ?></a></li> 194 <li><a href="<?php echo add_query_arg( array( 'page' => 'bp-components', 'action' => 'mustuse' ), bp_get_admin_url( $page ) ); ?>" <?php if ( $action === 'mustuse' ) : ?>class="current"<?php endif; ?>><?php printf( _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', count( $required_components ), 'buddypress' ), number_format_i18n( count( $required_components ) ) ); ?></a> | </li> 195 <li><a href="<?php echo add_query_arg( array( 'page' => 'bp-components', 'action' => 'retired' ), bp_get_admin_url( $page ) ); ?>" <?php if ( $action === 'retired' ) : ?>class="current"<?php endif; ?>><?php printf( _n( 'Retired <span class="count">(%s)</span>', 'Retired <span class="count">(%s)</span>', count( $retired_components ), 'buddypress' ), number_format_i18n( count( $retired_components ) ) ); ?></a></li> 185 196 </ul> 186 197 … … 214 225 endif; ?> 215 226 216 <tr id="<?php echo $name; ?>" class="<?php echo $name . ' ' . $class; ?>">227 <tr id="<?php echo esc_attr( $name ); ?>" class="<?php echo esc_attr( $name ) . ' ' . esc_attr( $class ); ?>"> 217 228 <th scope="row"> 218 229 … … 265 276 * 266 277 * @since BuddyPress (1.6) 267 * @todo Use settings API 268 * @global BuddyPress $bp 269 * @return false On failure 278 * @todo Use settings API when it supports saving network settings 279 * @return If not time to save settings 270 280 */ 271 281 function bp_core_admin_components_settings_handler() { 272 global $bp; 273 274 if ( isset( $_POST['bp-admin-component-submit'] ) ) { 275 if ( !check_admin_referer('bp-admin-component-setup') ) 276 return false; 277 278 // Settings form submitted, now save the settings. First, set active components 279 if ( isset( $_POST['bp_components'] ) ) { 280 // Save settings and upgrade schema 281 require_once( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-schema.php' ); 282 $bp->active_components = stripslashes_deep( $_POST['bp_components'] ); 283 bp_core_install( $bp->active_components ); 284 285 bp_update_option( 'bp-active-components', $bp->active_components ); 286 } 287 288 $base_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components', 'updated' => 'true' ), 'admin.php' ) ); 289 290 wp_redirect( $base_url ); 291 } 282 283 // Bail if not saving settings 284 if ( ! isset( $_POST['bp-admin-component-submit'] ) ) 285 return; 286 287 // Bail if nonce fails 288 if ( ! check_admin_referer( 'bp-admin-component-setup' ) ) 289 return; 290 291 // Settings form submitted, now save the settings. First, set active components 292 if ( isset( $_POST['bp_components'] ) ) { 293 294 // Load up BuddyPress 295 $bp = buddypress(); 296 297 // Save settings and upgrade schema 298 require_once( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-schema.php' ); 299 300 $bp->active_components = stripslashes_deep( $_POST['bp_components'] ); 301 302 bp_core_install( $bp->active_components ); 303 304 bp_update_option( 'bp-active-components', $bp->active_components ); 305 } 306 307 // Where are we redirecting to? 308 $base_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components', 'updated' => 'true' ), 'admin.php' ) ); 309 310 // Redirect 311 wp_redirect( $base_url ); 292 312 } 293 313 add_action( 'bp_admin_init', 'bp_core_admin_components_settings_handler' ); -
trunk/bp-core/admin/bp-core-functions.php
r6579 r6581 225 225 ); 226 226 227 // If forums component is active, add additional tab228 if ( bp_is_active( 'forums' ) ) {229 $tabs['3'] = array(230 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bb-forums-setup' ), 'admin.php' ) ),231 'name' => __( 'Forums', 'buddypress' )232 );233 }234 235 227 // Loop through tabs and build navigation 236 foreach( $tabs as $tab_id =>$tab_data ) {228 foreach( array_values( $tabs ) as $tab_data ) { 237 229 $is_current = (bool) ( $tab_data['name'] == $active_tab ); 238 230 $tab_class = $is_current ? $active_class : $idle_class; -
trunk/bp-core/bp-core-admin.php
r6579 r6581 50 50 public $js_url = ''; 51 51 52 53 52 /** Methods ***************************************************************/ 54 53 … … 75 74 */ 76 75 private function setup_globals() { 77 $bp = buddypress(); 76 $bp = buddypress(); 77 78 // Paths and URLs 78 79 $this->admin_dir = trailingslashit( $bp->plugin_dir . 'bp-core/admin' ); // Admin path 79 80 $this->admin_url = trailingslashit( $bp->plugin_url . 'bp-core/admin' ); // Admin url … … 81 82 $this->css_url = trailingslashit( $this->admin_url . 'css' ); // Admin css URL 82 83 $this->js_url = trailingslashit( $this->admin_url . 'js' ); // Admin css URL 84 85 // Main settings page 86 $this->settings_page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php'; 83 87 } 84 88 … … 164 168 165 169 $hooks = array(); 166 $page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';167 170 168 171 // Changed in BP 1.6 . See bp_core_admin_backpat_menu() … … 187 190 // Add the option pages 188 191 $hooks[] = add_submenu_page( 189 $ page,192 $this->settings_page, 190 193 __( 'BuddyPress Components', 'buddypress' ), 191 194 __( 'BuddyPress', 'buddypress' ), … … 196 199 197 200 $hooks[] = add_submenu_page( 198 $ page,201 $this->settings_page, 199 202 __( 'BuddyPress Pages', 'buddypress' ), 200 203 __( 'BuddyPress Pages', 'buddypress' ), … … 205 208 206 209 $hooks[] = add_submenu_page( 207 $ page,210 $this->settings_page, 208 211 __( 'BuddyPress Settings', 'buddypress' ), 209 212 __( 'BuddyPress Settings', 'buddypress' ), … … 279 282 /** Forums ************************************************************/ 280 283 281 if ( bp_is_active( 'forums' ) && bp_forums_is_installed_correctly()) {284 if ( bp_is_active( 'forums' ) ) { 282 285 283 286 // Add the main section 284 add_settings_section( 'bp_forums', __( ' Forums Settings', 'buddypress' ), 'bp_admin_setting_callback_bbpress_section', 'buddypress' );287 add_settings_section( 'bp_forums', __( 'Legacy Group Forums', 'buddypress' ), 'bp_admin_setting_callback_bbpress_section', 'buddypress' ); 285 288 286 289 // Allow subscriptions setting … … 323 326 return $links; 324 327 325 $page = 'bp-components';326 $text = __( 'Settings', 'buddypress' );327 $url = bp_core_do_network_admin() ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );328 329 328 // Add a few links to the existing links array 330 329 return array_merge( $links, array( 331 'settings' => '<a href="' . add_query_arg( array( 'page' => $page ), $url ) . '">' . $text. '</a>',332 'about' => '<a href="' . add_query_arg( array( 'page' => 'bp-about' ), admin_url( 'index.php' ) ) . '">' . esc_html__( 'About','buddypress' ) . '</a>'330 'settings' => '<a href="' . add_query_arg( array( 'page' => 'bp-components' ), bp_get_admin_url( $this->settings_page ) ) . '">' . esc_html__( 'Settings', 'buddypress' ) . '</a>', 331 'about' => '<a href="' . add_query_arg( array( 'page' => 'bp-about' ), bp_get_admin_url( 'index.php' ) ) . '">' . esc_html__( 'About', 'buddypress' ) . '</a>' 333 332 ) ); 334 333 } … … 340 339 */ 341 340 public function admin_head() { 342 $settings_page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';343 341 344 342 // Settings pages 345 remove_submenu_page( $settings_page, 'bb-forums-setup' ); 346 remove_submenu_page( $settings_page, 'bp-page-settings' ); 347 remove_submenu_page( $settings_page, 'bp-settings' ); 343 remove_submenu_page( $this->settings_page, 'bp-page-settings' ); 344 remove_submenu_page( $this->settings_page, 'bp-settings' ); 348 345 349 346 // About and Credits pages … … 374 371 */ 375 372 public function about_screen() { 376 377 // Switch page to use for settings378 $settings_page = bp_is_network_activated() ? 'settings.php' : 'options-general.php';379 373 380 374 list( $display_version ) = explode( '-', bp_get_version() ); ?> … … 462 456 */ 463 457 public function credits_screen() { 464 465 // Switch page to use for settings466 $settings_page = bp_is_network_activated() ? 'settings.php' : 'options-general.php';467 458 468 459 list( $display_version ) = explode( '-', bp_get_version() ); ?> … … 578 569 579 570 <div class="return-to-dashboard"> 580 <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $ settings_page ) ) ); ?>"><?php _e( 'Go to Community Settings' ); ?></a>571 <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $this->settings_page ) ) ); ?>"><?php _e( 'Go to Community Settings' ); ?></a> 581 572 </div> 582 573 -
trunk/bp-core/bp-core-update.php
r6579 r6581 144 144 */ 145 145 function bp_version_bump() { 146 $db_version = bp_get_db_version(); 147 bp_update_option( '_bp_db_version', $db_version ); 146 bp_update_option( '_bp_db_version', bp_get_db_version() ); 148 147 } 149 148 -
trunk/bp-forums/bp-forums-loader.php
r6342 r6581 35 35 * 36 36 * @since BuddyPress (1.5) 37 * @global BuddyPress $bp The one true BuddyPress instance38 37 */ 39 38 function setup_globals() { 40 global $bp;39 $bp = buddypress(); 41 40 42 41 // Define the parent forum ID … … 80 79 ); 81 80 82 // Admin area83 if ( is_admin() )84 $includes[] = 'admin';85 86 81 // bbPress stand-alone 87 82 if ( !defined( 'BB_PATH' ) ) … … 93 88 /** 94 89 * Setup BuddyBar navigation 95 *96 * @global BuddyPress $bp The one true BuddyPress instance97 90 */ 98 91 function setup_nav() { 99 global $bp;100 92 101 93 // Stop if forums haven't been set up yet … … 151 143 ); 152 144 153 // Favorite forums items. Disabled until future release.154 /*155 $sub_nav[] = array(156 'name' => __( 'Favorites', 'buddypress' ),157 'slug' => 'favorites',158 'parent_url' => $forums_link,159 'parent_slug' => $this->slug,160 'screen_function' => 'bp_member_forums_screen_favorites',161 'position' => 60,162 'item_css_id' => 'favorites'163 );164 */165 166 145 parent::setup_nav( $main_nav, $sub_nav ); 167 146 } … … 169 148 /** 170 149 * Set up the Toolbar 171 *172 * @global BuddyPress $bp The one true BuddyPress instance173 150 */ 174 151 function setup_admin_bar() { 175 global $bp;176 152 177 153 // Prevent debug notices … … 186 162 // Add the "My Account" sub menus 187 163 $wp_admin_nav[] = array( 188 'parent' => $bp->my_account_menu_id,164 'parent' => buddypress()->my_account_menu_id, 189 165 'id' => 'my-account-' . $this->id, 190 166 'title' => __( 'Forums', 'buddypress' ), … … 222 198 /** 223 199 * Sets up the title for pages and <title> 224 *225 * @global BuddyPress $bp The one true BuddyPress instance226 200 */ 227 201 function setup_title() { 228 global $bp;202 $bp = buddypress(); 229 203 230 204 // Adjust title based on view … … 247 221 248 222 function bp_setup_forums() { 249 global $bp; 250 251 $bp->forums = new BP_Forums_Component(); 223 buddypress()->forums = new BP_Forums_Component(); 252 224 } 253 225 add_action( 'bp_setup_components', 'bp_setup_forums', 6 ); -
trunk/bp-forums/deprecated/1.6.php
r6342 r6581 6 6 * This file contains all the deprecated functions for BuddyPress forums since 7 7 * version 1.6. This was a major update for the forums component, moving from 8 * bbPress 1. 1 to bbPress 2.1.8 * bbPress 1.x to bbPress 2.x. 9 9 * 10 10 * @package BuddyPress … … 42 42 else : ?> 43 43 44 <div style="width: 45%; float: left; margin-top: 20px;">44 <div> 45 45 <h3><?php _e( 'Forums for Groups', 'buddypress' ) ?></h3> 46 46 … … 58 58 <div> 59 59 <a class="button button-primary" href="<?php echo $action ?>"><?php _e( 'Reinstall Group Forums', 'buddypress' ) ?></a> 60 </div>61 </div>62 63 <div style="width: 45%; float: left; margin: 20px 0 20px 20px; padding: 0 20px 20px 20px; border: 1px solid #ddd; background-color: #fff;">64 <h3><?php _e( 'New! Site Wide Forums', 'buddypress' ) ?></h3>65 <p><?php _e( 'Your site will have central forums that are not isolated to any specific group. Choose this if you\'d like to have a central forum area for your members.', 'buddypress' ) ?></p>66 <p class="description"><?php _e( 'You may activate both Group and Site Wide forums, but this may create a poor experience for your members.', 'buddypress' ) ?></p>67 68 <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4>69 <ul class="description" style="list-style: square; margin-left: 30px;">70 <li><?php _e( 'Central Discussion Area', 'buddypress' ); ?></p></li>71 <li><?php _e( 'Forum Plugins Available', 'buddypress' ); ?></p></li>72 <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li>73 <li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li>74 </ul>75 <div>76 <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> 77 60 </div> 78 61 </div> … … 159 142 ?> 160 143 161 <div style="width: 45%; float: left; margin-top: 20px;">144 <div> 162 145 <h3><?php _e( 'Forums for Groups', 'buddypress' ) ?></h3> 163 146 … … 179 162 </div> 180 163 181 <div style="width: 45%; float: left; margin: 20px 0 20px 20px; padding: 0 20px 20px 20px; border: 1px solid #ddd; background-color: #fff;">182 <h3><?php _e( 'New! Site Wide Forums', 'buddypress' ) ?></h3>183 <p><?php _e( 'Your site will have central forums that are not isolated to any specific group. Choose this if you\'d like to have a central forum area for your members.', 'buddypress' ) ?></p>184 <p class="description"><?php _e( 'You may activate both Group and Site Wide forums, but this may create a poor experience for your members.', 'buddypress' ) ?></p>185 186 <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4>187 <ul class="description" style="list-style: square; margin-left: 30px;">188 <li><?php _e( 'Central Discussion Area', 'buddypress' ); ?></p></li>189 <li><?php _e( 'Forum Plugins Available', 'buddypress' ); ?></p></li>190 <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li>191 <li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li>192 </ul>193 <div>194 <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> 195 </div>196 </div>197 198 164 <?php } 199 165 break;
Note: See TracChangeset
for help on using the changeset viewer.