Changeset 6558
- Timestamp:
- 12/04/2012 12:16:42 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/admin/bp-core-components.php
r6343 r6558 44 44 * Creates reusable markup for component setup on the Components and Pages dashboard panel. 45 45 * 46 * This markup has been abstracted so that it can be used both during the setup wizard as well as47 * when BP has been fully installed.48 *49 46 * @package BuddyPress 50 47 * @since BuddyPress (1.6) … … 59 56 // Declare local variables 60 57 $deactivated_components = array(); 61 $required_components = array();62 58 $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) ); 59 60 // The default components (if none are previously selected) 61 $default_components = array( 62 'xprofile' => array( 63 'title' => __( 'Extended Profiles', 'buddypress' ), 64 'description' => __( 'Customize your community with fully editable profile fields that allow your users to describe themselves.', 'buddypress' ) 65 ) 66 ); 67 68 // Required components 69 $required_components = array( 70 'core' => array( 71 'title' => __( 'BuddyPress Core', 'buddypress' ), 72 'description' => __( 'It‘s what makes <del>time travel</del> BuddyPress possible!', 'buddypress' ) 73 ), 74 'members' => array( 75 'title' => __( 'Community Members', 'buddypress' ), 76 'description' => __( 'Everything in a BuddyPress community revolves around its members.', 'buddypress' ) 77 ), 78 ); 63 79 64 80 // Optional core components … … 103 119 } 104 120 105 // Required components106 $required_components = array(107 'core' => array(108 'title' => __( 'BuddyPress Core', 'buddypress' ),109 'description' => __( 'It‘s what makes <del>time travel</del> BuddyPress possible!', 'buddypress' )110 ),111 'members' => array(112 'title' => __( 'Community Members', 'buddypress' ),113 'description' => __( 'Everything in a BuddyPress community revolves around its members.', 'buddypress' )114 ),115 );116 117 121 // Merge optional and required together 118 122 $all_components = $optional_components + $required_components; … … 139 143 } 140 144 141 // On new install, set a ll components to be active bydefault142 if ( empty( $active_components ) && ( bp_get_maintenance_mode() == 'install' )) {143 $active_components = $ optional_components;145 // On new install, set active components to default 146 if ( empty( $active_components ) ) { 147 $active_components = $default_components; 144 148 } 145 149 … … 172 176 $current_components = $required_components; 173 177 break; 174 } 175 176 if ( ! bp_get_maintenance_mode() ) : ?> 178 } ?> 177 179 178 180 <ul class="subsubsub"> … … 182 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> 183 185 </ul> 184 185 <?php endif; ?>186 186 187 187 <table class="widefat fixed plugins" cellspacing="0"> … … 291 291 } 292 292 } 293 add_action( ' admin_init', 'bp_core_admin_components_settings_handler' );293 add_action( 'bp_admin_init', 'bp_core_admin_components_settings_handler' ); -
trunk/bp-core/admin/bp-core-functions.php
r6499 r6558 37 37 function bp_core_admin_backpat_menu() { 38 38 global $_parent_pages, $_registered_pages, $submenu; 39 40 // Don't do anything if a BP upgrade is in progress, or if the bp-wizard is in progress.41 if ( defined( 'BP_IS_UPGRADE' ) && BP_IS_UPGRADE || empty( $submenu['bp-general-settings'] ) )42 return;43 39 44 40 /** … … 47 43 * 'bp-general-settings' menu, it will only contain one item. Kill it. 48 44 */ 49 if ( 1 == count( $submenu['bp-general-settings'] ) ) {50 51 // This removes the top-level menu 52 remove_submenu_page( 'bp-general-settings', 'bp-general-settings' );53 remove_menu_page('bp-general-settings' );54 55 // These stop people accessing the URL directly 56 unset( $_parent_pages['bp-general-settings'] );57 unset( $_registered_pages['toplevel_page_bp-general-settings'] );58 }45 if ( 1 != count( $submenu['bp-general-settings'] ) ) 46 remove; 47 48 // This removes the top-level menu 49 remove_submenu_page( 'bp-general-settings', 'bp-general-settings' ); 50 remove_menu_page( 'bp-general-settings' ); 51 52 // These stop people accessing the URL directly 53 unset( $_parent_pages['bp-general-settings'] ); 54 unset( $_registered_pages['toplevel_page_bp-general-settings'] ); 59 55 } 60 56 add_action( bp_core_admin_hook(), 'bp_core_admin_backpat_menu', 999 ); 61 62 /**63 * Tweak the Settings subnav menu to show only one BuddyPress menu item (Settings > BuddyPress).64 *65 * @since BuddyPress (1.6)66 */67 function bp_core_modify_admin_menu() {68 $page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';69 70 remove_submenu_page( $page, 'bb-forums-setup' );71 remove_submenu_page( $page, 'bp-page-settings' );72 remove_submenu_page( $page, 'bp-settings' );73 }74 add_action( 'admin_head', 'bp_core_modify_admin_menu', 999 );75 57 76 58 /** … … 180 162 181 163 /** 182 * Verify that some BP prerequisites are set up properly, and notify the admin if not 183 * 184 * On every Dashboard page, this function checks the following: 185 * - that pretty permalinks are enabled 186 * - that a BP-compatible theme is activated 187 * - that every BP component that needs a WP page for a directory has one 188 * - that no WP page has multiple BP components associated with it 189 * The administrator will be shown a notice for each check that fails. 190 * 191 * @package BuddyPress Core 192 */ 193 function bp_core_activation_notice() { 194 global $wp_rewrite, $wpdb; 195 196 $bp = buddypress(); 197 198 // Only the super admin gets warnings 199 if ( !bp_current_user_can( 'bp_moderate' ) ) 200 return; 201 202 // On multisite installs, don't load on a non-root blog, unless do_network_admin is 203 // overridden 204 if ( is_multisite() && bp_core_do_network_admin() && !bp_is_root_blog() ) 205 return; 206 207 // Don't show these messages during setup or upgrade 208 if ( !empty( $bp->maintenance_mode ) ) 209 return; 210 211 /** 212 * Check to make sure that the blog setup routine has run. This can't happen during the 213 * wizard because of the order which the components are loaded. We check for multisite here 214 * on the off chance that someone has activated the blogs component and then disabled MS 215 */ 216 if ( bp_is_active( 'blogs' ) ) { 217 $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$bp->blogs->table_name}" ); 218 219 if ( empty( $count ) ) { 220 bp_blogs_record_existing_blogs(); 221 } 222 } 223 224 /** 225 * Are pretty permalinks enabled? 226 */ 227 if ( isset( $_POST['permalink_structure'] ) ) 228 return false; 229 230 if ( empty( $wp_rewrite->permalink_structure ) ) { 231 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' ) ) ); 232 } 233 234 /** 235 * Check for orphaned BP components (BP component is enabled, no WP page exists) 236 */ 237 $orphaned_components = array(); 238 $wp_page_components = array(); 239 240 // Only components with 'has_directory' require a WP page to function 241 foreach( array_keys( $bp->loaded_components ) as $component_id ) { 242 if ( !empty( $bp->{$component_id}->has_directory ) ) { 243 $wp_page_components[] = array( 244 'id' => $component_id, 245 'name' => isset( $bp->{$component_id}->name ) ? $bp->{$component_id}->name : ucwords( $bp->{$component_id}->id ) 246 ); 247 } 248 } 249 250 // Activate and Register are special cases. They are not components but they need WP pages. 251 // If user registration is disabled, we can skip this step. 252 if ( bp_get_signup_allowed() ) { 253 $wp_page_components[] = array( 254 'id' => 'activate', 255 'name' => __( 'Activate', 'buddypress' ) 256 ); 257 258 $wp_page_components[] = array( 259 'id' => 'register', 260 'name' => __( 'Register', 'buddypress' ) 261 ); 262 } 263 264 foreach( $wp_page_components as $component ) { 265 if ( !isset( $bp->pages->{$component['id']} ) ) { 266 $orphaned_components[] = $component['name']; 267 } 268 } 269 270 // Special case: If the Forums component is orphaned, but the bbPress 1.x installation is 271 // not correctly set up, don't show a nag. (In these cases, it's probably the case that the 272 // user is using bbPress 2.x; see https://buddypress.trac.wordpress.org/ticket/4292 273 if ( isset( $bp->forums->name ) && in_array( $bp->forums->name, $orphaned_components ) && !bp_forums_is_installed_correctly() ) { 274 $forum_key = array_search( $bp->forums->name, $orphaned_components ); 275 unset( $orphaned_components[$forum_key] ); 276 $orphaned_components = array_values( $orphaned_components ); 277 } 278 279 if ( !empty( $orphaned_components ) ) { 280 $admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ); 281 $notice = sprintf( __( 'The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $orphaned_components ) . '</strong>' ); 282 283 bp_core_add_admin_notice( $notice ); 284 } 285 286 /** 287 * BP components cannot share a single WP page. Check for duplicate assignments, and post 288 * a message if found. 289 */ 290 $dupe_names = array(); 291 $page_ids = (array)bp_core_get_directory_page_ids(); 292 $dupes = array_diff_assoc( $page_ids, array_unique( $page_ids ) ); 293 294 if ( !empty( $dupes ) ) { 295 foreach( array_keys( $dupes ) as $dupe_component ) { 296 $dupe_names[] = $bp->pages->{$dupe_component}->title; 297 } 298 299 // Make sure that there are no duplicate duplicates :) 300 $dupe_names = array_unique( $dupe_names ); 301 } 302 303 // If there are duplicates, post a message about them 304 if ( !empty( $dupe_names ) ) { 305 $admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ); 306 $notice = sprintf( __( 'Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $dupe_names ) . '</strong>' ); 307 308 bp_core_add_admin_notice( $notice ); 309 } 310 } 311 add_action( 'admin_init', 'bp_core_activation_notice' ); 312 313 /** 314 * Add an extra update message to the update plugin notification. 315 * 316 * @package BuddyPress Core 317 */ 318 function bp_core_update_message() { 319 echo '<p style="color: red; margin: 3px 0 0 0; border-top: 1px solid #ddd; padding-top: 3px">' . __( 'IMPORTANT: <a href="http://codex.buddypress.org/buddypress-site-administration/upgrading-buddypress/">Read this before attempting to update BuddyPress</a>', 'buddypress' ) . '</p>'; 320 } 321 add_action( 'in_plugin_update_message-buddypress/bp-loader.php', 'bp_core_update_message' ); 164 * Redirect user to bbPress's What's New page on activation 165 * 166 * @since bbPress (r4389) 167 * 168 * @internal Used internally to redirect bbPress to the about page on activation 169 * 170 * @uses get_transient() To see if transient to redirect exists 171 * @uses delete_transient() To delete the transient if it exists 172 * @uses is_network_admin() To bail if being network activated 173 * @uses wp_safe_redirect() To redirect 174 * @uses add_query_arg() To help build the URL to redirect to 175 * @uses admin_url() To get the admin URL to index.php 176 * 177 * @return If no transient, or in network admin, or is bulk activation 178 */ 179 function bp_do_activation_redirect() { 180 181 // Bail if no activation redirect 182 if ( ! get_transient( '_bp_activation_redirect' ) ) 183 return; 184 185 // Delete the redirect transient 186 delete_transient( '_bp_activation_redirect' ); 187 188 // Bail if activating from network, or bulk 189 if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) 190 return; 191 192 // Redirect to bbPress about page 193 wp_safe_redirect( add_query_arg( array( 'page' => 'bp-about' ), admin_url( 'index.php' ) ) ); 194 } 322 195 323 196 /** UI/Styling ****************************************************************/ … … 373 246 do_action( 'bp_admin_tabs' ); 374 247 } 375 376 /**377 * Add the confirmation inline javascript in the WP admin dashboard.378 *379 * Only add it if we're not in BP maintenance mode.380 *381 * @since BuddyPress (1.7)382 * @uses bp_get_maintenance_mode() To see if we're in BP maintenance mode.383 * @uses bp_core_confirmation_js() To output our inline JS.384 */385 function bp_core_admin_add_confirm_js() {386 if ( ! bp_get_maintenance_mode() )387 bp_core_confirmation_js();388 }389 add_action( 'admin_head', 'bp_core_admin_add_confirm_js' ); -
trunk/bp-core/admin/bp-core-slugs.php
r6456 r6558 43 43 /** 44 44 * Creates reusable markup for page setup on the Components and Pages dashboard panel. 45 *46 * This markup has been abstracted so that it can be used both during the setup wizard as well as47 * when BP has been fully installed.48 45 * 49 46 * @package BuddyPress … … 224 221 } 225 222 } 226 add_action( ' admin_init', 'bp_core_admin_slugs_setup_handler' );223 add_action( 'bp_admin_init', 'bp_core_admin_slugs_setup_handler' ); -
trunk/bp-core/admin/bp-core-update.php
r6344 r6558 4 4 if ( !defined( 'ABSPATH' ) ) exit; 5 5 6 class BP_Core_Setup_Wizard {7 8 /**9 * @var int The current step of the updater10 */11 var $current_step;12 13 /**14 *15 * @var array The total steps to be completed16 */17 var $steps;18 19 /** Methods ***************************************************************/20 21 function __construct() {22 23 // Set/reset the wizard cookie24 setcookie( 'bp-wizard-step', 0, time() + 60 * 60 * 24, COOKIEPATH );25 $_COOKIE['bp-wizard-step'] = 0;26 27 // Call the save method that will save data and modify $current_step28 if ( isset( $_POST['save'] ) )29 $this->save( $_POST['save'] );30 31 // Build the steps needed for update or new installations32 $this->steps = $this->add_steps();33 }34 35 function current_step() {36 if ( isset( $_POST['step'] ) ) {37 $current_step = (int) $_POST['step'] + 1;38 } else {39 if ( !empty( $_COOKIE['bp-wizard-step'] ) ) {40 $current_step = $_COOKIE['bp-wizard-step'];41 } else {42 $current_step = 0;43 }44 }45 46 return $current_step;47 }48 49 function add_steps() {50 51 // Setup wizard steps52 $steps = array();53 54 // This is a first time installation55 if ( bp_get_maintenance_mode() == 'install' ) {56 $steps = array(57 __( 'Components', 'buddypress' ),58 __( 'Pages', 'buddypress' ),59 __( 'Permalinks', 'buddypress' ),60 __( 'Finish', 'buddypress' )61 );62 63 // This is an update to an existing install64 } else {65 66 // New for BP 1.567 if ( bp_get_db_version_raw() < 1801 || !bp_core_get_directory_page_ids() ) {68 $steps[] = __( 'Components', 'buddypress' );69 $steps[] = __( 'Pages', 'buddypress' );70 }71 72 // New for BP 1.673 if ( bp_get_db_version_raw() < 5222 && !defined( 'BP_USE_WP_ADMIN_BAR' ) )74 $steps[] = __( 'Toolbar', 'buddypress' );75 76 if ( bp_get_db_version_raw() < (int) bp_get_db_version() )77 $steps[] = __( 'Database Update', 'buddypress' );78 79 $steps[] = __( 'Finish', 'buddypress' );80 }81 82 return $steps;83 }84 85 function save( $step_name ) {86 87 // Bail if user is not capable of being here88 if ( ! bp_current_user_can( 'activate_plugins' ) )89 wp_die( 'Uh... No.' );90 91 // Save any posted values92 switch ( $step_name ) {93 case 'db_update':94 $result = $this->step_db_update_save();95 break;96 97 case 'components':98 $result = $this->step_components_save();99 break;100 101 case 'pages':102 $result = $this->step_pages_save();103 break;104 105 case 'permalinks':106 $result = $this->step_permalinks_save();107 break;108 109 case 'admin_bar':110 $result = $this->step_admin_bar_save();111 break;112 113 case 'finish':114 default:115 $result = $this->step_finish_save();116 break;117 }118 119 if ( 'finish' != $step_name )120 setcookie( 'bp-wizard-step', (int) $this->current_step(), time() + 60 * 60 * 24, COOKIEPATH );121 }122 123 function html() {124 125 // Bail if user is not capable of being here126 if ( ! bp_current_user_can( 'activate_plugins' ) )127 wp_die( 'You do not have sufficient permissions to access this page.' );128 ?>129 130 <div class="wrap" id="bp-wizard">131 132 <?php screen_icon( 'buddypress' ); ?>133 134 <h2>135 <?php136 if ( 'update' == bp_get_maintenance_mode() )137 _e( 'BuddyPress Update', 'buddypress' );138 else139 _e( 'BuddyPress Setup', 'buddypress' );140 ?>141 </h2>142 143 <?php144 do_action( 'bp_admin_notices' );145 146 $step_count = count( $this->steps ) - 1;147 $wiz_or_set = $this->current_step() >= $step_count ? 'bp-components' : 'bp-wizard';148 $form_action = bp_core_do_network_admin() ? network_admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'admin.php' ) ) : admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'index.php' ) );149 ?>150 151 <form action="<?php echo $form_action; ?>" method="post" id="bp-wizard-form">152 <div id="bp-wizard-nav">153 <ol>154 155 <?php foreach( (array) $this->steps as $i => $name ) : ?>156 157 <li<?php if ( $this->current_step() == $i ) : ?> class="current"<?php endif; ?>>158 <?php if ( $this->current_step() > $i ) : ?>159 160 <span class="complete"> </span>161 162 <?php else :163 164 echo $i + 1 . '. ';165 166 endif;167 168 echo esc_attr( $name ) ?>169 170 </li>171 172 <?php endforeach; ?>173 174 </ol>175 176 <?php if ( __( 'Finish', 'buddypress' ) == $this->steps[$this->current_step()] ) : ?>177 178 <div class="prev-next submit clear">179 <input type="submit" value="<?php _e( 'Finish & Activate', 'buddypress' ); ?>" name="submit" />180 </div>181 182 <?php else : ?>183 184 <div class="prev-next submit clear">185 <input type="submit" value="<?php _e( 'Save & Next', 'buddypress' ); ?>" name="submit" />186 </div>187 188 <?php endif; ?>189 190 </div>191 192 <div id="bp-wizard-content">193 194 <?php switch ( $this->steps[$this->current_step()] ) {195 case __( 'Database Update', 'buddypress') :196 $this->step_db_update();197 break;198 199 case __( 'Components', 'buddypress') :200 $this->step_components();201 break;202 203 case __( 'Pages', 'buddypress') :204 $this->step_pages();205 break;206 207 case __( 'Permalinks', 'buddypress') :208 $this->step_permalinks();209 break;210 211 case __( 'Toolbar', 'buddypress' ) :212 $this->step_admin_bar();213 break;214 215 case __( 'Finish', 'buddypress') :216 $this->step_finish();217 break;218 } ?>219 220 </div>221 </form>222 </div>223 224 <?php225 }226 227 /** Screen methods ********************************************************/228 229 function step_db_update() {230 ?>231 232 <p><?php _e( 'To complete the update, a few changes need to be made to your database. These changes are not destructive and will not remove or change any existing settings.', 'buddypress' ); ?></p>233 234 <div class="submit clear">235 <input type="hidden" name="save" value="db_update" />236 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />237 238 <?php wp_nonce_field( 'bpwizard_db_update' ) ?>239 240 </div>241 242 <?php243 }244 245 function step_components() {246 247 if ( !function_exists( 'bp_core_admin_components_options' ) )248 require ( BP_PLUGIN_DIR . 'bp-core/admin/bp-core-components.php' );249 250 bp_core_admin_components_options(); ?>251 252 <div class="submit clear">253 <input type="hidden" name="save" value="components" />254 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />255 256 <?php wp_nonce_field( 'bpwizard_components' ); ?>257 258 </div>259 260 <?php261 }262 263 function step_pages() {264 global $wpdb;265 266 // Get BuddyPress once in this scope267 $bp = buddypress();268 269 // Make sure that page info is pulled from bp_get_root_blog_id() (except when in270 // multisite mode)271 if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != bp_get_root_blog_id() ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )272 switch_to_blog( bp_get_root_blog_id() );273 274 $existing_pages = bp_core_get_directory_page_ids();275 276 // Provide empty indexes to avoid PHP errors with wp_dropdown_pages()277 $indexes = array( 'members', 'activity', 'groups', 'forums', 'blogs', 'register', 'activate' );278 foreach ( $indexes as $index ) {279 if ( !isset( $existing_pages[$index] ) ) {280 $existing_pages[$index] = '';281 }282 }283 284 if ( !empty( $existing_pages['blogs'] ) )285 $existing_blog_page = '&selected=' . $existing_pages['blogs'];286 else287 $existing_blog_page = '';288 289 // Get active components290 $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );291 292 // Check for defined slugs293 $members_slug = !empty( $bp->members->slug ) ? $bp->members->slug : __( 'members', 'buddypress' );294 295 // Groups296 $groups_slug = !empty( $bp->groups->slug ) ? $bp->groups->slug : __( 'groups', 'buddypress' );297 298 // Activity299 $activity_slug = !empty( $bp->activity->slug ) ? $bp->activity->slug : __( 'activity', 'buddypress' );300 301 // Forums302 $forums_slug = !empty( $bp->forums->slug ) ? $bp->forums->slug : __( 'forums', 'buddypress' );303 304 // Blogs305 $blogs_slug = !empty( $bp->blogs->slug ) ? $bp->blogs->slug : __( 'blogs', 'buddypress' );306 307 // Register308 $register_slug = !empty( $bp->register->slug ) ? $bp->register->slug : __( 'register', 'buddypress' );309 310 // Activation311 $activation_slug = !empty( $bp->activation->slug ) ? $bp->activation->slug : __( 'activate', 'buddypress' );312 313 ?>314 315 <script type="text/javascript">316 jQuery( document ).ready( function() {317 jQuery( 'select' ).change( function() {318 jQuery( this ).siblings( 'input[type=radio]' ).click();319 });320 });321 </script>322 323 <?php if ( bp_get_maintenance_mode() ) : ?>324 325 <p><?php _e( 'BuddyPress uses WordPress pages to display directories. This allows you to easily change their titles and relocate them.', 'buddypress' ); ?></p>326 <p><?php _e( 'Choose an existing page, have one auto-created, or create them manually and come back here once you are finished.', 'buddypress' ); ?></p>327 328 <?php endif; ?>329 330 <table class="form-table">331 332 <tr valign="top">333 <th scope="row">334 <h5><?php _e( 'Members', 'buddypress' ); ?></h5>335 <p><?php _e( 'Displays member profiles, and a directory of all site members.', 'buddypress' ); ?></p>336 </th>337 <td>338 <p><label><input type="radio" name="bp_pages[members]" <?php checked( empty( $existing_pages['members'] ) ); ?> value="<?php echo $members_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $members_slug ); ?>/</label></p>339 340 <?php if ( $members_page_dropdown = wp_dropdown_pages( "name=bp-members-page&echo=0&selected={$existing_pages['members']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>341 342 <p><label><input type="radio" name="bp_pages[members]" <?php checked( !empty( $existing_pages['members'] ) ); ?> value="<?php echo get_post_field( 'post_name', $existing_pages['members'] ); ?>" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $members_page_dropdown ?></label></p>343 344 <?php endif ?>345 </td>346 </tr>347 348 <?php if ( isset( $active_components['groups'] ) ) : ?>349 350 <tr valign="top">351 <th scope="row">352 <h5><?php _e( 'Groups', 'buddypress' ); ?></h5>353 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ); ?></p>354 </th>355 <td>356 <p><label><input type="radio" name="bp_pages[groups]" <?php checked( empty( $existing_pages['groups'] ) ); ?> value="<?php echo $groups_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $groups_slug ); ?>/</label></p>357 358 <?php if ( $groups_page_dropdown = wp_dropdown_pages( "name=bp-groups-page&echo=0&selected={$existing_pages['groups']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>359 <p><label><input type="radio" name="bp_pages[groups]" <?php checked( !empty( $existing_pages['groups'] ) ); ?> value="<?php echo get_post_field( 'post_name', $existing_pages['groups'] ); ?>" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $groups_page_dropdown ?></label></p>360 <?php endif ?>361 </td>362 </tr>363 364 <?php endif; ?>365 366 <?php /* The Blogs component only needs a directory page when Multisite is enabled */ ?>367 <?php if ( is_multisite() && isset( $active_components['blogs'] ) ) : ?>368 369 <tr valign="top">370 <th scope="row">371 <h5><?php _e( 'Blogs', 'buddypress' ); ?></h5>372 <p><?php _e( 'Displays a directory of the blogs in your network.', 'buddypress' ); ?></p>373 </th>374 <td>375 <p><label><input type="radio" name="bp_pages[blogs]" <?php checked( empty( $existing_pages['blogs'] ) ); ?> value="<?php echo $blogs_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $blogs_slug ); ?>/</label></p>376 377 <?php if ( $blogs_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['blogs']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>378 <p><label><input type="radio" name="bp_pages[blogs]" <?php checked( !empty( $existing_pages['blogs'] ) ); ?> value="<?php echo get_post_field( 'post_name', $existing_pages['blogs'] ); ?>" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $blogs_page_dropdown ?></label></p>379 <?php endif ?>380 </td>381 </tr>382 383 <?php endif; ?>384 385 <?php if ( isset( $active_components['activity'] ) ) : ?>386 387 <tr valign="top">388 <th scope="row">389 <h5><?php _e( 'Activity', 'buddypress' ); ?></h5>390 <p><?php _e( "Displays the activity for the entire site, a member's friends, groups and @mentions.", 'buddypress' ); ?></p>391 </th>392 <td>393 <p><label><input type="radio" name="bp_pages[activity]" <?php checked( empty( $existing_pages['activity'] ) ); ?> value="<?php echo $activity_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $activity_slug ); ?>/</label></p>394 395 <?php if ( $activity_page_dropdown = wp_dropdown_pages( "name=bp-activity-page&echo=0&selected={$existing_pages['activity']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>396 <p><label><input type="radio" name="bp_pages[activity]" <?php checked( !empty( $existing_pages['activity'] ) ); ?> value="<?php echo get_post_field( 'post_name', $existing_pages['activity'] ); ?>" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $activity_page_dropdown ?></label></p>397 <?php endif ?>398 </td>399 </tr>400 401 <?php endif; ?>402 403 <?php if ( isset( $active_components['forums'] ) ) : ?>404 405 <tr valign="top">406 <th scope="row">407 <h5><?php _e( 'Forums', 'buddypress' ); ?></h5>408 <p><?php _e( 'Displays a directory of public forum topics.', 'buddypress' ); ?></p>409 </th>410 <td>411 <p><label><input type="radio" name="bp_pages[forums]" <?php checked( empty( $existing_pages['forums'] ) ); ?> value="<?php echo $forums_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $forums_slug ); ?>/</label></p>412 413 <?php if ( $forums_page_dropdown = wp_dropdown_pages( "name=bp-forums-page&echo=0&selected={$existing_pages['forums']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>414 <p><label><input type="radio" name="bp_pages[forums]" <?php checked( !empty( $existing_pages['forums'] ) ); ?> value="<?php echo get_post_field( 'post_name', $existing_pages['forums'] ); ?>" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $forums_page_dropdown ?></label></p>415 <?php endif ?>416 </td>417 </tr>418 419 <?php endif; ?>420 421 <tr valign="top">422 <th scope="row">423 <h5><?php _e( 'Register', 'buddypress' ); ?></h5>424 <p><?php _e( 'Displays a site registration page where users can create new accounts.', 'buddypress' ); ?></p>425 </th>426 <td>427 <p><label><input type="radio" name="bp_pages[register]" <?php checked( empty( $existing_pages['register'] ) ); ?> value="<?php echo $register_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $register_slug ) ?>/</label></p>428 429 <?php if ( $register_page_dropdown = wp_dropdown_pages( "name=bp-register-page&echo=0&selected={$existing_pages['register']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>430 <p><label><input type="radio" name="bp_pages[register]" <?php checked( !empty( $existing_pages['register'] ) ); ?> value="<?php echo get_post_field( 'post_name', $existing_pages['register'] ); ?>" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $register_page_dropdown ?></label></p>431 <?php endif ?>432 </td>433 </tr>434 435 <tr valign="top">436 <th scope="row">437 <h5><?php _e( 'Activate', 'buddypress' ); ?></h5>438 <p><?php _e( 'The page users will visit to activate their account once they have registered.', 'buddypress' ); ?></p>439 </th>440 <td>441 <p><label><input type="radio" name="bp_pages[activate]" <?php checked( empty( $existing_pages['activate'] ) ); ?> value="<?php echo $activation_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $activation_slug ); ?>/</label></p>442 443 <?php if ( $activate_page_dropdown = wp_dropdown_pages( "name=bp-activate-page&echo=0&selected={$existing_pages['activate']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>444 <p><label><input type="radio" name="bp_pages[activate]" <?php checked( !empty( $existing_pages['activate'] ) ); ?> value="<?php echo get_post_field( 'post_name', $existing_pages['activate'] ); ?>" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $activate_page_dropdown ?></label></p>445 <?php endif ?>446 </td>447 </tr>448 </table>449 450 <div class="submit clear">451 <input type="hidden" name="save" value="pages" />452 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />453 454 <?php wp_nonce_field( 'bpwizard_pages' ); ?>455 456 </div>457 458 <?php459 460 restore_current_blog();461 }462 463 function step_permalinks() {464 465 $prefix = '';466 $permalink_structure = bp_get_option( 'permalink_structure' );467 $structures = array( '', $prefix . '/%year%/%monthnum%/%day%/%postname%/', $prefix . '/%year%/%monthnum%/%postname%/', $prefix . '/archives/%post_id%' );468 469 if ( !got_mod_rewrite() && !iis7_supports_permalinks() )470 $prefix = '/index.php'; ?>471 472 <p><?php473 474 // If we're using permalinks already, adjust text accordingly475 if ( !empty( $permalink_structure ) ) {476 _e( 'Your permalink settings are compatible with BuddyPress.', 'buddypress' );477 } else {478 _e( 'Pretty permalinks must be active on your site.', 'buddypress' );479 }480 481 ?></p>482 <p><?php printf( __( 'For more advanced options please visit the <a href="%s">permalink settings page</a> now and come back here later.', 'buddypress' ), admin_url( 'options-permalink.php' ) ); ?>483 484 <table class="form-table">485 486 <?php if ( !empty( $permalink_structure ) && ! in_array( $permalink_structure, $structures ) ) : ?>487 <tr>488 <th><label><input name="permalink_structure" type="radio" checked="checked" value="<?php echo esc_attr( $permalink_structure ); ?>" class="tog" <?php checked( true ); ?> /> <?php _e( 'Current' ); ?></label></th>489 <td><code><?php echo get_home_url() . $prefix . $permalink_structure; ?></code></td>490 </tr>491 <?php endif; ?>492 493 <tr>494 <th><label><input name="permalink_structure" type="radio"<?php if ( empty( $permalink_structure ) || false != strpos( $permalink_structure, $structures[1] ) ) : ?> checked="checked" <?php endif; ?>value="<?php echo esc_attr( $structures[1] ); ?>" class="tog" <?php checked( $structures[1], $permalink_structure ); ?> /> <?php _e( 'Day and name' ); ?></label></th>495 <td><code><?php echo get_home_url() . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></td>496 </tr>497 <tr>498 <th><label><input name="permalink_structure" type="radio"<?php if ( empty( $permalink_structure ) || false != strpos( $permalink_structure, $structures[2] ) ) : ?> checked="checked" <?php endif; ?> value="<?php echo esc_attr( $structures[2] ); ?>" class="tog" <?php checked( $structures[2], $permalink_structure ); ?> /> <?php _e( 'Month and name' ); ?></label></th>499 <td><code><?php echo get_home_url() . $prefix . '/' . date('Y') . '/' . date('m') . '/sample-post/'; ?></code></td>500 </tr>501 <tr>502 <th><label><input name="permalink_structure" type="radio"<?php if ( empty( $permalink_structure ) || false != strpos( $permalink_structure, $structures[3] ) ) : ?> checked="checked" <?php endif; ?> value="<?php echo esc_attr( $structures[3] ); ?>" class="tog" <?php checked( $structures[3], $permalink_structure ); ?> /> <?php _e( 'Numeric' ); ?></label></th>503 <td><code><?php echo get_home_url() . $prefix ?>/archives/123</code></td>504 </tr>505 </table>506 507 <div class="submit clear">508 <input type="hidden" name="save" value="permalinks" />509 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />510 511 <?php if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && empty( $_POST['skip-htaccess'] ) ) : ?>512 513 <input type="hidden" name="skip-htaccess" value="skip-htaccess" />514 515 <?php endif; ?>516 517 <?php wp_nonce_field( 'bpwizard_permalinks' ); ?>518 519 </div>520 521 <?php522 }523 524 /**525 * When upgrading to BP 1.6, prompt the admin to switch to WordPress' Toolbar.526 *527 * @since BuddyPress (1.6)528 */529 function step_admin_bar() {530 ?>531 532 <p><?php _e( "BuddyPress now uses the WordPress Toolbar; we've turbo-charged it by adding social items to help your users explore your site and manage their content.", 'buddypress' ); ?></p>533 534 <p><?php _e( "We've noticed that your site uses the old bar from earlier versions of BuddyPress.", 'buddypress' ); ?></p>535 536 <p>537 <label>538 <input type="checkbox" name="keep_buddybar" value="1" />539 <?php _e( "If you'd prefer to not switch to the WordPress Toolbar just yet, check this box. Don't worry, you can change your mind later.", 'buddypress' ); ?>540 </label>541 </p>542 543 <div class="submit clear">544 <input type="hidden" name="save" value="admin_bar" />545 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />546 547 <?php wp_nonce_field( 'bpwizard_admin_bar' ) ?>548 549 </div>550 551 <?php552 }553 554 function step_finish() {555 ?>556 <p>557 <?php558 if ( 'update' == bp_get_maintenance_mode() )559 _e( "The BuddyPress update is complete, and your site is ready to go!", 'buddypress' );560 else561 _e( "The BuddyPress setup is complete, and your site is ready to go!", 'buddypress' );562 ?>563 </p>564 565 <div class="submit clear">566 <input type="hidden" name="save" value="finish" />567 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step() ); ?>" />568 569 <?php wp_nonce_field( 'bpwizard_finish' ); ?>570 571 </div>572 573 <?php574 }575 576 /** Save Step Methods *****************************************************/577 578 function step_db_update_save() {579 580 if ( ! isset( $_POST['submit'] ) )581 return false;582 583 check_admin_referer( 'bpwizard_db_update' );584 585 // Run the schema install to update tables586 bp_core_install();587 588 // Update to 1.5589 if ( bp_get_db_version_raw() < 1801 )590 $this->update_1_5();591 592 // Update to 1.6593 if ( bp_get_db_version_raw() < bp_get_db_version() )594 $this->update_1_6();595 596 return true;597 }598 599 function step_components_save() {600 601 if ( ! isset( $_POST['submit'] ) || ! isset( $_POST['bp_components'] ) )602 return false;603 604 check_admin_referer( 'bpwizard_components' );605 606 $active_components = array();607 608 // Settings form submitted, now save the settings.609 foreach ( (array) $_POST['bp_components'] as $key => $value ) {610 $active_components[$key] = 1;611 }612 613 bp_update_option( 'bp-active-components', $active_components );614 615 wp_cache_flush();616 bp_core_install();617 618 return true;619 }620 621 function step_pages_save() {622 623 if ( ! isset( $_POST['submit'] ) || ! isset( $_POST['bp_pages'] ) )624 return false;625 626 check_admin_referer( 'bpwizard_pages' );627 628 // Make sure that the pages are created on the bp_get_root_blog_id()629 //no matter which Dashboard the setup is being run on.630 if ( !defined( 'BP_ENABLE_MULTIBLOG' ) )631 switch_to_blog( bp_get_root_blog_id() );632 633 $blog_pages = $this->setup_pages( (array) $_POST['bp_pages'] );634 bp_update_option( 'bp-pages', $blog_pages );635 636 if ( !defined( 'BP_ENABLE_MULTIBLOG' ) )637 restore_current_blog();638 639 return true;640 }641 642 function step_permalinks_save() {643 global $wp_rewrite, $current_site, $current_blog;644 645 // Prevent debug notices646 $iis7_permalinks = $usingpi = $writable = false;647 648 if ( ! isset( $_POST['submit'] ) )649 return false;650 651 check_admin_referer( 'bpwizard_permalinks' );652 653 $home_path = get_home_path();654 $iis7_permalinks = iis7_supports_permalinks();655 656 if ( isset( $_POST['permalink_structure'] ) ) {657 $permalink_structure = $_POST['permalink_structure'];658 659 if ( !empty( $permalink_structure ) )660 $permalink_structure = preg_replace( '#/+#', '/', '/' . $_POST['permalink_structure'] );661 662 if ( ( defined( 'VHOST' ) && constant( 'VHOST' ) == 'no' ) && $permalink_structure != '' && $current_site->domain . $current_site->path == $current_blog->domain . $current_blog->path )663 $permalink_structure = '/blog' . $permalink_structure;664 665 $wp_rewrite->set_permalink_structure( $permalink_structure );666 }667 668 if ( !empty( $iis7_permalinks ) ) {669 if ( ( !file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) {670 $writable = true;671 }672 } else {673 if ( ( !file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {674 $writable = true;675 }676 }677 678 if ( $wp_rewrite->using_index_permalinks() )679 $usingpi = true;680 681 $wp_rewrite->flush_rules();682 683 if ( !empty( $iis7_permalinks ) || ( empty( $usingpi ) && empty( $writable ) ) ) {684 685 function _bp_core_wizard_step_permalinks_message() {686 global $wp_rewrite; ?>687 688 <div id="message" class="updated fade"><p>689 690 <?php691 _e( 'Oops, there was a problem creating a configuration file. ', 'buddypress' );692 693 if ( !empty( $iis7_permalinks ) ) {694 695 if ( !empty( $permalink_structure ) && empty( $usingpi ) && empty( $writable ) ) {696 697 _e( 'If your <code>web.config</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your <code>web.config</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this rule inside of the <code>/<configuration>/<system.webServer>/<rewrite>/<rules></code> element in <code>web.config</code> file.' ); ?>698 699 <br /><br />700 701 <textarea rows="9" class="large-text readonly" style="background: #fff;" name="rules" id="rules" readonly="readonly"><?php echo esc_html( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea>702 703 <?php704 705 } else if ( !empty( $permalink_structure ) && empty( $usingpi ) && !empty( $writable ) ); {706 _e( 'Permalink structure updated. Remove write access on web.config file now!' );707 }708 709 } else {710 711 _e( 'If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.' ); ?>712 713 <br /><br />714 715 <textarea rows="6" class="large-text readonly" style="background: #fff;" name="rules" id="rules" readonly="readonly"><?php echo esc_html( $wp_rewrite->mod_rewrite_rules() ); ?></textarea>716 717 <?php } ?>718 719 <br /><br />720 721 <?php722 if ( empty( $iis7_permalinks ) )723 _e( 'Paste all these rules into a new <code>.htaccess</code> file in the root of your WordPress installation and save the file. Once you\'re done, please hit the "Save and Next" button to continue.', 'buddypress' );724 ?>725 726 </p></div>727 728 <?php729 }730 731 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && !empty( $_POST['skip-htaccess'] ) ) {732 return true;733 } else {734 add_action( 'bp_admin_notices', '_bp_core_wizard_step_permalinks_message' );735 return false;736 }737 }738 739 return true;740 }741 742 /**743 * When upgrading to BP 1.6, the admin is prompted to switch to WordPress' Toolbar.744 * If they choose not to, record that preference in the options table.745 *746 * @since BuddyPress (1.6)747 */748 function step_admin_bar_save() {749 if ( ! isset( $_POST['submit'] ) )750 return false;751 752 check_admin_referer( 'bpwizard_admin_bar' );753 754 if ( !empty( $_POST['keep_buddybar'] ) )755 bp_update_option( '_bp_force_buddybar', 1 );756 757 return true;758 }759 760 function step_finish_save() {761 762 if ( ! isset( $_POST['submit'] ) )763 return false;764 765 check_admin_referer( 'bpwizard_finish' );766 767 // Update the DB version in the database768 bp_version_bump();769 770 // Delete the setup cookie771 @setcookie( 'bp-wizard-step', '', time() - 3600, COOKIEPATH );772 773 // Redirect to the BuddyPress dashboard774 $redirect = bp_core_do_network_admin() ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );775 $redirect = add_query_arg( array( 'page' => 'bp-components' ), $redirect );776 777 wp_safe_redirect( $redirect );778 779 // That's all!780 exit();781 }782 783 function setup_pages( $pages ) {784 785 $bp_pages = array();786 787 // Delete any existing pages788 foreach ( (array) bp_core_get_directory_page_ids() as $page_id ) {789 wp_delete_post( $page_id, true );790 }791 bp_delete_option( 'bp-pages' );792 793 foreach ( $pages as $key => $value ) {794 795 // Check for the selected page796 if ( 'page' == $value ) {797 if ( !empty( $_POST['bp-' . $key . '-page'] ) ) {798 $bp_pages[$key] = (int) $_POST['bp-' . $key . '-page'];799 } else {800 $bp_pages[$key] = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords( $key ), 'post_status' => 'publish', 'post_type' => 'page' ) );801 }802 803 // Create a new page804 } else {805 $bp_pages[$key] = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords( $value ), 'post_status' => 'publish', 'post_type' => 'page' ) );806 }807 }808 809 return $bp_pages;810 }811 812 // Database update methods based on version numbers813 function update_1_5() {814 delete_site_option( 'bp-activity-db-version' );815 delete_site_option( 'bp-blogs-db-version' );816 delete_site_option( 'bp-friends-db-version' );817 delete_site_option( 'bp-groups-db-version' );818 delete_site_option( 'bp-messages-db-version' );819 delete_site_option( 'bp-xprofile-db-version' );820 }821 822 // Database update methods based on version numbers823 function update_1_6() {824 825 // Delete possible site options826 delete_site_option( 'bp-db-version' );827 delete_site_option( '_bp_db_version' );828 delete_site_option( 'bp-core-db-version' );829 delete_site_option( '_bp-core-db-version' );830 831 // Delete possible blog options832 delete_blog_option( bp_get_root_blog_id(), 'bp-db-version' );833 delete_blog_option( bp_get_root_blog_id(), 'bp-core-db-version' );834 delete_site_option( bp_get_root_blog_id(), '_bp-core-db-version' );835 delete_site_option( bp_get_root_blog_id(), '_bp_db_version' );836 }837 838 /**839 * Reset the cookie so the install script starts over840 */841 function reset_cookie() {842 @setcookie( 'bp-wizard-step', '', time() - 3600, COOKIEPATH );843 }844 }845 846 /**847 * Get the wizard848 *849 * @return boolean850 */851 function bp_get_wizard() {852 $bp = buddypress();853 854 if ( !empty( $bp->admin->wizard ) )855 return $bp->admin->wizard;856 857 return false;858 } -
trunk/bp-core/admin/css/common.css
r6293 r6558 22 22 /* Menu Icons 23 23 ------------------------------------------------------------------------------*/ 24 25 /* Wizard */26 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image {27 background-image: url('../images/menu.png') !important;28 background-position: -178px -34px;29 }30 ul#adminmenu li.toplevel_page_bp-wizard:hover .wp-menu-image,31 ul#adminmenu li.toplevel_page_bp-wizard.wp-has-current-submenu .wp-menu-image {32 background-position: -178px -2px;33 }34 24 35 25 /* Backpat */ … … 179 169 vertical-align: top; 180 170 } 171 172 /* Version Badge */ 173 174 .bp-badge { 175 padding-top: 142px; 176 height: 50px; 177 width: 173px; 178 color: #fafafa; 179 font-weight: bold; 180 font-size: 14px; 181 text-align: center; 182 margin: 0 -5px; 183 background: #f00 no-repeat; 184 } 185 186 .about-wrap .bp-badge { 187 position: absolute; 188 top: 0; 189 right: 0; 190 } 191 body.rtl .about-wrap .bp-badge { 192 right: auto; 193 left: 0; 194 } -
trunk/bp-core/bp-core-admin.php
r6422 r6558 21 21 class BP_Admin { 22 22 23 /**24 * Instance of the setup wizard25 *26 * @since BuddyPress (1.6)27 * @var BP_Core_Setup_Wizard28 */29 public $wizard;30 31 23 /** Directory *************************************************************/ 32 24 … … 98 90 */ 99 91 private function includes() { 100 101 // If in maintenance mode, only include updater and schema 102 if ( bp_get_maintenance_mode() ) { 103 require( $this->admin_dir . 'bp-core-schema.php' ); 104 require( $this->admin_dir . 'bp-core-update.php' ); 105 106 // No update needed so proceed with loading everything 107 } else { 108 require( $this->admin_dir . 'bp-core-settings.php' ); 109 require( $this->admin_dir . 'bp-core-functions.php' ); 110 require( $this->admin_dir . 'bp-core-components.php' ); 111 require( $this->admin_dir . 'bp-core-slugs.php' ); 112 } 92 require( $this->admin_dir . 'bp-core-actions.php' ); 93 require( $this->admin_dir . 'bp-core-settings.php' ); 94 require( $this->admin_dir . 'bp-core-functions.php' ); 95 require( $this->admin_dir . 'bp-core-components.php' ); 96 require( $this->admin_dir . 'bp-core-slugs.php' ); 113 97 } 114 98 … … 124 108 private function setup_actions() { 125 109 126 // Start the wizard if in maintenance mode127 if ( bp_get_maintenance_mode() ) {128 add_action( bp_core_admin_hook(), array( $this, 'start_wizard' ), 2 );129 }130 131 110 /** General Actions ***************************************************/ 132 111 133 // Attach the BuddyPress admin_init action to the WordPress admin_init action.134 add_action( 'admin_init', array( $this, 'admin_init' ) );135 136 112 // Add some page specific output to the <head> 137 add_action( ' admin_head', array( $this, 'admin_head' ));113 add_action( 'bp_admin_head', array( $this, 'admin_head' ), 999 ); 138 114 139 115 // Add menu item to settings menu 140 add_action( bp_core_admin_hook(), array( $this, 'admin_menus' ), 5 ); 141 142 // Add notice if an update is needed 143 add_action( 'admin_notices', array( $this, 'admin_notices' ) ); 144 add_action( 'network_admin_notices', array( $this, 'admin_notices' ) ); 116 add_action( bp_core_admin_hook(), array( $this, 'admin_menus' ), 5 ); 145 117 146 118 // Enqueue all admin JS and CSS 147 add_action( ' admin_enqueue_scripts', array( $this, 'enqueue_scripts') );119 add_action( 'bp_admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 148 120 149 121 /** BuddyPress Actions ************************************************/ 150 122 151 123 // Add settings 152 add_action( 'bp_ admin_init',array( $this, 'register_admin_settings' ) );124 add_action( 'bp_register_admin_settings', array( $this, 'register_admin_settings' ) ); 153 125 154 126 /** Filters ***********************************************************/ 155 127 156 128 // Add link to settings page 157 add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 ); 158 } 159 160 public function start_wizard() { 161 $this->wizard = new BP_Core_Setup_Wizard; 129 add_filter( 'plugin_action_links', array( $this, 'modify_plugin_action_links' ), 10, 2 ); 162 130 } 163 131 … … 173 141 public function admin_menus() { 174 142 175 // In maintenance mode 176 if ( bp_get_maintenance_mode() ) { 177 178 if ( !current_user_can( 'manage_options' ) ) { 179 return; 180 } 181 182 if ( bp_get_maintenance_mode() == 'install' ) { 183 $status = __( 'BuddyPress Setup', 'buddypress' ); 184 } else { 185 $status = __( 'Update BuddyPress', 'buddypress' ); 186 } 187 188 if ( bp_get_wizard() ) { 189 if ( ! is_multisite() || bp_is_multiblog_mode() ) { 190 $hook = add_dashboard_page( $status, $status, 'manage_options', 'bp-wizard', array( bp_get_wizard(), 'html' ) ); 191 } else { 192 $hook = add_submenu_page( 'update-core.php', $status, $status, 'manage_options', 'bp-wizard', array( bp_get_wizard(), 'html' ) ); 193 } 194 } 195 196 // Not in maintenance mode 197 } else { 198 199 // Bail if user cannot moderate 200 if ( ! bp_current_user_can( 'manage_options' ) ) { 201 return; 202 } 203 204 $hooks = array(); 205 $page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php'; 206 207 // Changed in BP 1.6 . See bp_core_admin_backpat_menu() 208 $hooks[] = add_menu_page( 209 __( 'BuddyPress', 'buddypress' ), 210 __( 'BuddyPress', 'buddypress' ), 211 'manage_options', 212 'bp-general-settings', 213 'bp_core_admin_backpat_menu', 214 'div' 215 ); 216 217 $hooks[] = add_submenu_page( 218 'bp-general-settings', 219 __( 'BuddyPress Help', 'buddypress' ), 220 __( 'Help', 'buddypress' ), 221 'manage_options', 222 'bp-general-settings', 223 'bp_core_admin_backpat_page' 224 ); 225 226 // Add the option pages 227 $hooks[] = add_submenu_page( 228 $page, 229 __( 'BuddyPress Components', 'buddypress' ), 230 __( 'BuddyPress', 'buddypress' ), 231 'manage_options', 232 'bp-components', 233 'bp_core_admin_components_settings' 234 ); 235 236 $hooks[] = add_submenu_page( 237 $page, 238 __( 'BuddyPress Pages', 'buddypress' ), 239 __( 'BuddyPress Pages', 'buddypress' ), 240 'manage_options', 241 'bp-page-settings', 242 'bp_core_admin_slugs_settings' 243 ); 244 245 $hooks[] = add_submenu_page( 246 $page, 247 __( 'BuddyPress Settings', 'buddypress' ), 248 __( 'BuddyPress Settings', 'buddypress' ), 249 'manage_options', 250 'bp-settings', 251 'bp_core_admin_settings' 252 ); 253 254 // Fudge the highlighted subnav item when on a BuddyPress admin page 255 foreach( $hooks as $hook ) { 256 add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' ); 257 } 143 // Bail if user cannot moderate 144 if ( ! bp_current_user_can( 'manage_options' ) ) 145 return; 146 147 // About 148 add_dashboard_page( 149 __( 'Welcome to BuddyPress', 'buddypress' ), 150 __( 'Welcome to BuddyPress', 'buddypress' ), 151 'manage_options', 152 'bp-about', 153 array( $this, 'about_screen' ) 154 ); 155 156 // Credits 157 add_dashboard_page( 158 __( 'Welcome to BuddyPress', 'buddypress' ), 159 __( 'Welcome to BuddyPress', 'buddypress' ), 160 'manage_options', 161 'bp-credits', 162 array( $this, 'credits_screen' ) 163 ); 164 165 $hooks = array(); 166 $page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php'; 167 168 // Changed in BP 1.6 . See bp_core_admin_backpat_menu() 169 $hooks[] = add_menu_page( 170 __( 'BuddyPress', 'buddypress' ), 171 __( 'BuddyPress', 'buddypress' ), 172 'manage_options', 173 'bp-general-settings', 174 'bp_core_admin_backpat_menu', 175 'div' 176 ); 177 178 $hooks[] = add_submenu_page( 179 'bp-general-settings', 180 __( 'BuddyPress Help', 'buddypress' ), 181 __( 'Help', 'buddypress' ), 182 'manage_options', 183 'bp-general-settings', 184 'bp_core_admin_backpat_page' 185 ); 186 187 // Add the option pages 188 $hooks[] = add_submenu_page( 189 $page, 190 __( 'BuddyPress Components', 'buddypress' ), 191 __( 'BuddyPress', 'buddypress' ), 192 'manage_options', 193 'bp-components', 194 'bp_core_admin_components_settings' 195 ); 196 197 $hooks[] = add_submenu_page( 198 $page, 199 __( 'BuddyPress Pages', 'buddypress' ), 200 __( 'BuddyPress Pages', 'buddypress' ), 201 'manage_options', 202 'bp-page-settings', 203 'bp_core_admin_slugs_settings' 204 ); 205 206 $hooks[] = add_submenu_page( 207 $page, 208 __( 'BuddyPress Settings', 'buddypress' ), 209 __( 'BuddyPress Settings', 'buddypress' ), 210 'manage_options', 211 'bp-settings', 212 'bp_core_admin_settings' 213 ); 214 215 // Fudge the highlighted subnav item when on a BuddyPress admin page 216 foreach( $hooks as $hook ) { 217 add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' ); 258 218 } 259 219 } … … 267 227 * @uses add_settings_field() To add various settings fields 268 228 * @uses register_setting() To register various settings 269 * @uses do_action() Calls 'bp_register_admin_settings'270 229 */ 271 230 public function register_admin_settings() { … … 347 306 } 348 307 } 349 350 do_action( 'bp_register_admin_settings' );351 308 } 352 309 … … 360 317 * @return array Processed links 361 318 */ 362 public function add_settings_link( $links, $file ) { 363 if ( buddypress()->basename == $file ) { 364 $page = 'bp-components'; 365 $text = __( 'Settings', 'buddypress' ); 366 $url = bp_core_do_network_admin() ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' ); 367 368 // If we're in install mode then the link needs to show "Wizard" and link 369 // to the wizard. Otherwise we can show the BuddyPress settings page link. 370 if ( 'install' == bp_get_maintenance_mode() ) { 371 $page = 'bp-wizard'; 372 $text = __( 'Setup Wizard', 'buddypress' ); 373 $url = bp_core_do_network_admin() ? network_admin_url( 'admin.php?page=' . $page ) : admin_url( 'index.php?page=' . $page ); 374 } 375 376 $settings_link = '<a href="' . add_query_arg( array( 'page' => $page ), $url ) . '">' . $text . '</a>'; 377 378 array_unshift( $links, $settings_link ); 379 } 380 381 return $links; 382 } 383 384 /** 385 * BuddyPress's dedicated admin init action 386 * 387 * @since BuddyPress (1.6) 388 * 389 * @uses do_action() Calls 'bp_admin_init' 390 */ 391 public function admin_init() { 392 do_action( 'bp_admin_init' ); 319 public function modify_plugin_action_links( $links, $file ) { 320 321 // Return normal links if not BuddyPress 322 if ( plugin_basename( buddypress()->file ) != $file ) 323 return $links; 324 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 // Add a few links to the existing links array 330 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>' 333 ) ); 393 334 } 394 335 … … 398 339 * @since BuddyPress (1.6) 399 340 */ 400 public function admin_head() { } 341 public function admin_head() { 342 $settings_page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php'; 343 344 // 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' ); 348 349 // About and Credits pages 350 remove_submenu_page( 'index.php', 'bp-about' ); 351 remove_submenu_page( 'index.php', 'bp-credits' ); 352 } 401 353 402 354 /** … … 412 364 $file = apply_filters( 'bp_core_admin_common_css', $file ); 413 365 wp_enqueue_style( 'bp-admin-common-css', $file, array(), bp_get_version() ); 414 415 // Extra bits for the installation wizard 416 if ( bp_get_maintenance_mode() ) { 417 418 // Styling 419 $file = $this->css_url . "wizard{$min}.css"; 420 $file = apply_filters( 'bp_core_admin_wizard_css', $file ); 421 wp_enqueue_style( 'bp-admin-wizard-css', $file, array(), bp_get_version() ); 422 423 // JS 424 $file = $this->js_url . "wizard{$min}.js"; 425 $file = apply_filters( 'bp_core_admin_wizard_js', $file ); 426 wp_enqueue_script( 'bp-admin-wizard-js', $file, array(), bp_get_version() ); 427 428 // We'll need the thickbox too 429 wp_enqueue_script( 'thickbox' ); 430 wp_enqueue_style( 'thickbox' ); 431 } 432 433 do_action( 'bp_admin_head' ); 434 } 435 436 /** 437 * Add any admin notices we might need, mostly for update or new installs 438 * 439 * @since BuddyPress (1.6) 440 * 441 * @global string $pagenow 442 * @return If no notice is needed 443 */ 444 public function admin_notices() { 445 global $pagenow; 446 447 // Bail if not in maintenance mode 448 if ( ! bp_get_maintenance_mode() ) 449 return; 450 451 // Bail if user cannot manage options 452 if ( ! current_user_can( 'manage_options' ) ) 453 return; 454 455 // Are we looking at a network? 456 if ( bp_core_do_network_admin() ) { 457 458 // Bail if looking at wizard page 459 if ( ( 'admin.php' == $pagenow ) && ( !empty( $_GET['page'] ) && ( 'bp-wizard' == $_GET['page'] ) ) ) { 460 return; 461 } 462 463 // Set the url for the nag 464 $url = network_admin_url( 'admin.php?page=bp-wizard' ); 465 466 // Single site 467 } else { 468 469 // Bail if looking at wizard page 470 if ( ( 'index.php' == $pagenow ) && ( !empty( $_GET['page'] ) && ( 'bp-wizard' == $_GET['page'] ) ) ) { 471 return; 472 } 473 474 // Set the url for the nag 475 $url = admin_url( 'index.php?page=bp-wizard' ); 476 } 477 478 // What does the nag say? 479 switch ( bp_get_maintenance_mode() ) { 480 481 // Update text 482 case 'update' : 483 $msg = sprintf( __( 'BuddyPress has been updated! Please run the <a href="%s">update wizard</a>.', 'buddypress' ), esc_url( $url ) ); 484 break; 485 486 // First install text 487 case 'install' : default : 488 $msg = sprintf( __( 'BuddyPress was successfully activated! Please run the <a href="%s">installation wizard</a>.', 'buddypress' ), esc_url( $url ) ); 489 break; 490 } ?> 491 492 <div class="update-nag"><?php echo $msg; ?></div> 366 } 367 368 /** About *****************************************************************/ 369 370 /** 371 * Output the about screen 372 * 373 * @since BuddyPress (1.7) 374 */ 375 public function about_screen() { 376 377 list( $display_version ) = explode( '-', bp_get_version() ); ?> 378 379 <div class="wrap about-wrap"> 380 <h1><?php printf( __( 'Welcome to BuddyPress %s' ), $display_version ); ?></h1> 381 <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! BuddyPress %s is ready to make your community a safer, faster, and better looking place to hang out!' ), $display_version ); ?></div> 382 <div class="bp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> 383 384 <h2 class="nav-tab-wrapper"> 385 <a class="nav-tab nav-tab-active" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-about' ), 'index.php' ) ) ); ?>"> 386 <?php _e( 'What’s New' ); ?> 387 </a><a class="nav-tab" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'index.php' ) ) ); ?>"> 388 <?php _e( 'Credits' ); ?> 389 </a> 390 </h2> 391 392 <div class="changelog"> 393 <h3><?php _e( 'Some neat thing', 'buddypress' ); ?></h3> 394 395 <div class="feature-section"> 396 <h4><?php _e( 'Whoa', 'buddypress' ); ?></h4> 397 <p><?php _e( 'Nice!', 'buddypress' ); ?></p> 398 399 <h4><?php _e( 'Wow', 'buddypress' ); ?></h4> 400 <p><?php _e( 'Amazing!', 'buddypress' ); ?></p> 401 </div> 402 </div> 403 404 <div class="changelog"> 405 <h3><?php _e( 'Another neat thing', 'buddypress' ); ?></h3> 406 407 <div class="feature-section"> 408 <h4><?php _e( 'No way', 'buddypress' ); ?></h4> 409 <p><?php _e( 'Yes way.', 'buddypress' ); ?></p> 410 </div> 411 </div> 412 413 <div class="changelog"> 414 <h3><?php _e( 'Under the Hood', 'buddypress' ); ?></h3> 415 416 <div class="feature-section three-col"> 417 <div> 418 <h4><?php _e( 'One', 'buddypress' ); ?></h4> 419 <p><?php _e( 'Uh huh.', 'buddypress' ); ?></p> 420 421 <h4><?php _e( 'Two', 'buddypress' ); ?></h4> 422 <p><?php _e( 'Yeah.', 'buddypress' ); ?></p> 423 </div> 424 425 <div> 426 <h4><?php _e( 'Three', 'buddypress' ); ?></h4> 427 <p><?php _e( 'I hear ya.', 'buddypress' ); ?></p> 428 429 <h4><?php _e( 'Four', 'buddypress' ); ?></h4> 430 <p><?php _e( 'Tell me more.', 'buddypress' ); ?></p> 431 </div> 432 433 <div class="last-feature"> 434 <h4><?php _e( 'Five', 'buddypress' ); ?></h4> 435 <p><?php _e( 'Well, shucks.', 'buddypress' ); ?></p> 436 437 <h4><?php _e( 'Six', 'buddypress' ); ?></h4> 438 <p><?php _e( ' Whoopie!', 'buddypress' ); ?></p> 439 </div> 440 </div> 441 </div> 442 443 <div class="return-to-dashboard"> 444 <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'buddypress' ), 'options-general.php' ) ) ); ?>"><?php _e( 'Go to Community Settings' ); ?></a> 445 </div> 446 447 </div> 448 449 <?php 450 } 451 452 /** 453 * Output the credits screen 454 * 455 * Hardcoding this in here is pretty janky. It's fine for 2.2, but we'll 456 * want to leverage api.wordpress.org eventually. 457 * 458 * @since BuddyPress (1.7) 459 */ 460 public function credits_screen() { 461 462 list( $display_version ) = explode( '-', bp_get_version() ); ?> 463 464 <div class="wrap about-wrap"> 465 <h1><?php printf( __( 'Welcome to BuddyPress %s' ), $display_version ); ?></h1> 466 <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! BuddyPress %s is ready to make your community a safer, faster, and better looking place to hang out!' ), $display_version ); ?></div> 467 <div class="bp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> 468 469 <h2 class="nav-tab-wrapper"> 470 <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-about' ), 'index.php' ) ) ); ?>" class="nav-tab"> 471 <?php _e( 'What’s New' ); ?> 472 </a><a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active"> 473 <?php _e( 'Credits' ); ?> 474 </a> 475 </h2> 476 477 <p class="about-description"><?php _e( 'BuddyPress is created by a worldwide network of friendly folks.', 'buddypress' ); ?></p> 478 479 <h4 class="wp-people-group"><?php _e( 'Project Leaders', 'buddypress' ); ?></h4> 480 <ul class="wp-people-group " id="wp-people-group-project-leaders"> 481 <li class="wp-person" id="wp-person-apeatling"> 482 <a href="http://profiles.wordpress.org/apeatling"><img src="http://0.gravatar.com/avatar/767fc9c115a1b989744c755db47feb60?s=60" class="gravatar" alt="Andy Peatling" /></a> 483 <a class="web" href="http://profiles.wordpress.org/apeatling">Andy Peatling</a> 484 <span class="title"><?php _e( 'Founding Developer', 'buddypress' ); ?></span> 485 </li> 486 <li class="wp-person" id="wp-person-johnjamesjacoby"> 487 <a href="http://profiles.wordpress.org/johnjamesjacoby"><img src="http://0.gravatar.com/avatar/81ec16063d89b162d55efe72165c105f?s=60" class="gravatar" alt="John James Jacoby" /></a> 488 <a class="web" href="http://profiles.wordpress.org/johnjamesjacoby">John James Jacoby</a> 489 <span class="title"><?php _e( 'Project Lead', 'buddypress' ); ?></span> 490 </li> 491 <li class="wp-person" id="wp-person-boonebgorges"> 492 <a href="http://profiles.wordpress.org/boonebgorges"><img src="http://0.gravatar.com/avatar/6a7c997edea340616bcc6d0fe03f65dd?s=60" class="gravatar" alt="Boone B. Gorges" /></a> 493 <a class="web" href="http://profiles.wordpress.org/boonebgorges">Boone B. Gorges</a> 494 <span class="title"><?php _e( 'Lead Developer', 'buddypress' ); ?></span> 495 </li> 496 <li class="wp-person" id="wp-person-djpaul"> 497 <a href="http://profiles.wordpress.org/djpaul"><img src="http://0.gravatar.com/avatar/e341eca9e1a85dcae7127044301b4363?s=60" class="gravatar" alt="Paul Gibbs" /></a> 498 <a class="web" href="http://profiles.wordpress.org/djpaul">Paul Gibbs</a> 499 <span class="title"><?php _e( 'Lead Developer', 'buddypress' ); ?></span> 500 </li> 501 </ul> 502 503 <h4 class="wp-people-group"><?php _e( 'Contributing Developers', 'buddypress' ); ?></h4> 504 <ul class="wp-people-group " id="wp-people-group-contributing-developers"> 505 <li class="wp-person" id="wp-person-jmdodd"> 506 <a href="http://profiles.wordpress.org/jmdodd"><img src="http://0.gravatar.com/avatar/6a7c997edea340616bcc6d0fe03f65dd?s=60" class="gravatar" alt="Jennifer M. Dodd" /></a> 507 <a class="web" href="http://profiles.wordpress.org/jmdodd">Jennifer M. Dodd</a> 508 <span class="title"></span> 509 </li> 510 <li class="wp-person" id="wp-person-jaredatch"> 511 <a href="http://profiles.wordpress.org/jaredatch"><img src="http://0.gravatar.com/avatar/e341eca9e1a85dcae7127044301b4363?s=60" class="gravatar" alt="Jared Atchison" /></a> 512 <a class="web" href="http://profiles.wordpress.org/jaredatch">Jared Atchison</a> 513 <span class="title"></span> 514 </li> 515 <li class="wp-person" id="wp-person-gautamgupta"> 516 <a href="http://profiles.wordpress.org/gautamgupta"><img src="http://0.gravatar.com/avatar/b0810422cbe6e4eead4def5ae7a90b34?s=60" class="gravatar" alt="Gautam Gupta" /></a> 517 <a class="web" href="http://profiles.wordpress.org/gautamgupta">Gautam Gupta</a> 518 <span class="title"></span> 519 </li> 520 </ul> 521 522 <h4 class="wp-people-group"><?php _e( 'Codex Rockstars', 'buddypress' ); ?></h4> 523 <ul class="wp-people-group " id="wp-people-group-codex-rockstars"> 524 <li class="wp-person" id="wp-person-masonjames"> 525 <a href="http://profiles.wordpress.org/masonjames"><img src="http://0.gravatar.com/avatar/99dee4d5287d0f9e26ff72e7228d97ac?s=60" class="gravatar" alt="Mason James" /></a> 526 <a class="web" href="http://profiles.wordpress.org/masonjames">Mason James</a> 527 <span class="title"></span> 528 </li> 529 <li class="wp-person" id="wp-person-wordsforwp"> 530 <a href="http://profiles.wordpress.org/wordsforwp"><img src="http://0.gravatar.com/avatar/5437119b446adad1af813c44944e6c9c?s=60" class="gravatar" alt="Siobhan McKeown" /></a> 531 <a class="web" href="http://profiles.wordpress.org/wordsforwp">Siobhan McKeown</a> 532 <span class="title"></span> 533 </li> 534 <li class="wp-person" id="wp-person-JarretC"> 535 <a href="http://profiles.wordpress.org/JarretC"><img src="http://0.gravatar.com/avatar/e00501bf782b42d5db19ff75fca14f6a?s=60" class="gravatar" alt="Jarret Cade" /></a> 536 <a class="web" href="http://profiles.wordpress.org/JarretC">Jarret Cade</a> 537 <span class="title"></span> 538 </li> 539 </ul> 540 541 <h4 class="wp-people-group"><?php _e( 'Core Contributors to BuddyPress 1.7', 'buddypress' ); ?></h4> 542 <p class="wp-credits-list"> 543 <a href="http://profiles.wordpress.org/alexvorn2">alexvorn2</a>, 544 <a href="http://profiles.wordpress.org/anointed">anointed</a>, 545 <a href="http://profiles.wordpress.org/chexee">chexee</a>, 546 <a href="http://profiles.wordpress.org/cnorris23">cnorris23</a>, 547 <a href="http://profiles.wordpress.org/DanielJuhl">DanielJuhl</a>, 548 <a href="http://profiles.wordpress.org/daveshine">daveshine</a>, 549 <a href="http://profiles.wordpress.org/dimadin">dimadin</a>, 550 <a href="http://profiles.wordpress.org/gawain">gawain</a>, 551 <a href="http://profiles.wordpress.org/iamzippy">iamzippy</a>, 552 <a href="http://profiles.wordpress.org/isaacchapman">isaacchapman</a>, 553 <a href="http://profiles.wordpress.org/jane">jane</a>, 554 <a href="http://profiles.wordpress.org/jkudish">jkudish</a>, 555 <a href="http://profiles.wordpress.org/mamaduka">mamaduka</a>, 556 <a href="http://profiles.wordpress.org/mercime">mercime</a>, 557 <a href="http://profiles.wordpress.org/mesayre">mesayre</a>, 558 <a href="http://profiles.wordpress.org/mordauk">mordauk</a>, 559 <a href="http://profiles.wordpress.org/MZAWeb">MZAWeb</a>, 560 <a href="http://profiles.wordpress.org/netweb">netweb</a>, 561 <a href="http://profiles.wordpress.org/nexia">nexia</a>, 562 <a href="http://profiles.wordpress.org/Omicron7">Omicron7</a>, 563 <a href="http://profiles.wordpress.org/otto42">otto42</a>, 564 <a href="http://profiles.wordpress.org/pavelevap">pavelevap</a>, 565 <a href="http://profiles.wordpress.org/plescheff">plescheff</a>, 566 <a href="http://profiles.wordpress.org/scribu">scribu</a>, 567 <a href="http://profiles.wordpress.org/sorich87">sorich87</a>, 568 <a href="http://profiles.wordpress.org/SteveAtty">SteveAtty</a>, 569 <a href="http://profiles.wordpress.org/tmoorewp">tmoorewp</a>, 570 <a href="http://profiles.wordpress.org/tott">tott</a>, 571 <a href="http://profiles.wordpress.org/tungdo">tungdo</a>, 572 <a href="http://profiles.wordpress.org/vibol">vibol</a>, 573 <a href="http://profiles.wordpress.org/wonderboymusic">wonderboymusic</a>, 574 <a href="http://profiles.wordpress.org/westi">westi</a>, 575 <a href="http://profiles.wordpress.org/xiosen">xiosen</a>, 576 </p> 577 578 <div class="return-to-dashboard"> 579 <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'buddypress' ), 'options-general.php' ) ) ); ?>"><?php _e( 'Go to Community Settings' ); ?></a> 580 </div> 581 582 </div> 493 583 494 584 <?php -
trunk/bp-core/bp-core-cssjs.php
r6342 r6558 4 4 5 5 function bp_core_confirmation_js() { 6 global $wpdb;7 6 8 if ( is_multisite() && $wpdb->blogid != bp_get_root_blog_id() )7 if ( is_multisite() && ! bp_is_root_blog() ) 9 8 return false; 10 9 … … 19 18 <?php 20 19 } 21 add_action( 'wp_head', 'bp_core_confirmation_js', 100 ); 20 add_action( 'wp_head', 'bp_core_confirmation_js', 100 ); 21 add_action( 'admin_head', 'bp_core_confirmation_js', 100 ); 22 22 23 23 /** -
trunk/bp-core/bp-core-functions.php
r6492 r6558 79 79 80 80 return $retval; 81 }82 83 /**84 * Output the BuddyPress maintenance mode85 *86 * @since BuddyPress (1.6)87 * @uses bp_get_maintenance_mode() To get the BuddyPress maintenance mode88 */89 function bp_maintenance_mode() {90 echo bp_get_maintenance_mode();91 }92 /**93 * Return the BuddyPress maintenance mode94 *95 * @since BuddyPress (1.6)96 * @global BuddyPress $bp97 * @return string The BuddyPress maintenance mode98 */99 function bp_get_maintenance_mode() {100 global $bp;101 return $bp->maintenance_mode;102 81 } 103 82 -
trunk/bp-core/deprecated/1.7.php
r6485 r6558 11 11 if ( !defined( 'ABSPATH' ) ) exit; 12 12 13 /** 14 * Output the BuddyPress maintenance mode 15 * 16 * @since BuddyPress (1.6) 17 * @uses bp_get_maintenance_mode() To get the BuddyPress maintenance mode 18 */ 19 function bp_maintenance_mode() { 20 echo bp_get_maintenance_mode(); 21 } 22 /** 23 * Return the BuddyPress maintenance mode 24 * 25 * @since BuddyPress (1.6) 26 * @return string The BuddyPress maintenance mode 27 */ 28 function bp_get_maintenance_mode() { 29 return buddypress()->maintenance_mode; 30 } 13 31 14 32 function xprofile_get_profile() { … … 59 77 return $themes; 60 78 } 79 80 /** Admin *********************************************************************/ 81 82 83 /** 84 * Verify that some BP prerequisites are set up properly, and notify the admin if not 85 * 86 * On every Dashboard page, this function checks the following: 87 * - that pretty permalinks are enabled 88 * - that a BP-compatible theme is activated 89 * - that every BP component that needs a WP page for a directory has one 90 * - that no WP page has multiple BP components associated with it 91 * The administrator will be shown a notice for each check that fails. 92 * 93 * @package BuddyPress Core 94 */ 95 function bp_core_activation_notice() { 96 global $wp_rewrite, $wpdb; 97 98 $bp = buddypress(); 99 100 // Only the super admin gets warnings 101 if ( !bp_current_user_can( 'bp_moderate' ) ) 102 return; 103 104 // On multisite installs, don't load on a non-root blog, unless do_network_admin is 105 // overridden 106 if ( is_multisite() && bp_core_do_network_admin() && !bp_is_root_blog() ) 107 return; 108 109 // Don't show these messages during setup or upgrade 110 if ( !empty( $bp->maintenance_mode ) ) 111 return; 112 113 /** 114 * Check to make sure that the blog setup routine has run. This can't happen during the 115 * wizard because of the order which the components are loaded. We check for multisite here 116 * on the off chance that someone has activated the blogs component and then disabled MS 117 */ 118 if ( bp_is_active( 'blogs' ) ) { 119 $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$bp->blogs->table_name}" ); 120 121 if ( empty( $count ) ) { 122 bp_blogs_record_existing_blogs(); 123 } 124 } 125 126 /** 127 * Are pretty permalinks enabled? 128 */ 129 if ( isset( $_POST['permalink_structure'] ) ) 130 return false; 131 132 if ( empty( $wp_rewrite->permalink_structure ) ) { 133 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' ) ) ); 134 } 135 136 /** 137 * Check for orphaned BP components (BP component is enabled, no WP page exists) 138 */ 139 $orphaned_components = array(); 140 $wp_page_components = array(); 141 142 // Only components with 'has_directory' require a WP page to function 143 foreach( array_keys( $bp->loaded_components ) as $component_id ) { 144 if ( !empty( $bp->{$component_id}->has_directory ) ) { 145 $wp_page_components[] = array( 146 'id' => $component_id, 147 'name' => isset( $bp->{$component_id}->name ) ? $bp->{$component_id}->name : ucwords( $bp->{$component_id}->id ) 148 ); 149 } 150 } 151 152 // Activate and Register are special cases. They are not components but they need WP pages. 153 // If user registration is disabled, we can skip this step. 154 if ( bp_get_signup_allowed() ) { 155 $wp_page_components[] = array( 156 'id' => 'activate', 157 'name' => __( 'Activate', 'buddypress' ) 158 ); 159 160 $wp_page_components[] = array( 161 'id' => 'register', 162 'name' => __( 'Register', 'buddypress' ) 163 ); 164 } 165 166 foreach( $wp_page_components as $component ) { 167 if ( !isset( $bp->pages->{$component['id']} ) ) { 168 $orphaned_components[] = $component['name']; 169 } 170 } 171 172 // Special case: If the Forums component is orphaned, but the bbPress 1.x installation is 173 // not correctly set up, don't show a nag. (In these cases, it's probably the case that the 174 // user is using bbPress 2.x; see https://buddypress.trac.wordpress.org/ticket/4292 175 if ( isset( $bp->forums->name ) && in_array( $bp->forums->name, $orphaned_components ) && !bp_forums_is_installed_correctly() ) { 176 $forum_key = array_search( $bp->forums->name, $orphaned_components ); 177 unset( $orphaned_components[$forum_key] ); 178 $orphaned_components = array_values( $orphaned_components ); 179 } 180 181 if ( !empty( $orphaned_components ) ) { 182 $admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ); 183 $notice = sprintf( __( 'The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $orphaned_components ) . '</strong>' ); 184 185 bp_core_add_admin_notice( $notice ); 186 } 187 188 /** 189 * BP components cannot share a single WP page. Check for duplicate assignments, and post 190 * a message if found. 191 */ 192 $dupe_names = array(); 193 $page_ids = (array)bp_core_get_directory_page_ids(); 194 $dupes = array_diff_assoc( $page_ids, array_unique( $page_ids ) ); 195 196 if ( !empty( $dupes ) ) { 197 foreach( array_keys( $dupes ) as $dupe_component ) { 198 $dupe_names[] = $bp->pages->{$dupe_component}->title; 199 } 200 201 // Make sure that there are no duplicate duplicates :) 202 $dupe_names = array_unique( $dupe_names ); 203 } 204 205 // If there are duplicates, post a message about them 206 if ( !empty( $dupe_names ) ) { 207 $admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ); 208 $notice = sprintf( __( 'Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $dupe_names ) . '</strong>' ); 209 210 bp_core_add_admin_notice( $notice ); 211 } 212 } -
trunk/bp-loader.php
r6537 r6558 279 279 /** Loading ***********************************************************/ 280 280 281 $this->maintenance_mode = '';282 281 $this->load_deprecated = true; 283 282 … … 377 376 /** Update/Install ****************************************************/ 378 377 379 // This is a new installation 380 if ( is_admin() ) { 381 382 // New installation 383 if ( empty( $this->db_version_raw ) ) { 384 $this->maintenance_mode = 'install'; 385 386 // Update 387 } elseif ( (int) $this->db_version_raw < (int) $this->db_version ) { 388 $this->maintenance_mode = 'update'; 389 } 390 391 // The installation process requires a few BuddyPress core libraries 392 if ( !empty( $this->maintenance_mode ) ) { 393 require( $this->plugin_dir . 'bp-core/bp-core-admin.php' ); 394 require( $this->plugin_dir . 'bp-core/bp-core-functions.php' ); 395 require( $this->plugin_dir . 'bp-core/bp-core-template.php' ); 396 require( $this->plugin_dir . 'bp-core/bp-core-update.php' ); 397 require( $this->plugin_dir . 'bp-core/bp-core-caps.php' ); 398 require( $this->plugin_dir . 'bp-core/bp-core-options.php' ); 399 400 /** 401 * Textdomain is usually loaded via the bp_core_loaded action, but 402 * that action isn't available when BP is in maintenance mode. 403 */ 404 add_action( 'plugins_loaded', 'bp_core_load_buddypress_textdomain', 9 ); 405 406 // Load up BuddyPress's admin 407 add_action( 'plugins_loaded', 'bp_admin' ); 408 } 409 } 410 411 // Not in maintenance mode 412 if ( empty( $this->maintenance_mode ) ) { 413 414 // Theme compatability 415 require( $this->plugin_dir . 'bp-core/bp-core-template-loader.php' ); 416 require( $this->plugin_dir . 'bp-core/bp-core-theme-compatibility.php' ); 417 418 // Require all of the BuddyPress core libraries 419 require( $this->plugin_dir . 'bp-core/bp-core-dependency.php' ); 420 require( $this->plugin_dir . 'bp-core/bp-core-actions.php' ); 421 require( $this->plugin_dir . 'bp-core/bp-core-caps.php' ); 422 require( $this->plugin_dir . 'bp-core/bp-core-cache.php' ); 423 require( $this->plugin_dir . 'bp-core/bp-core-cssjs.php' ); 424 require( $this->plugin_dir . 'bp-core/bp-core-update.php' ); 425 require( $this->plugin_dir . 'bp-core/bp-core-options.php' ); 426 require( $this->plugin_dir . 'bp-core/bp-core-classes.php' ); 427 require( $this->plugin_dir . 'bp-core/bp-core-filters.php' ); 428 require( $this->plugin_dir . 'bp-core/bp-core-avatars.php' ); 429 require( $this->plugin_dir . 'bp-core/bp-core-widgets.php' ); 430 require( $this->plugin_dir . 'bp-core/bp-core-template.php' ); 431 require( $this->plugin_dir . 'bp-core/bp-core-adminbar.php' ); 432 require( $this->plugin_dir . 'bp-core/bp-core-buddybar.php' ); 433 require( $this->plugin_dir . 'bp-core/bp-core-catchuri.php' ); 434 require( $this->plugin_dir . 'bp-core/bp-core-component.php' ); 435 require( $this->plugin_dir . 'bp-core/bp-core-functions.php' ); 436 require( $this->plugin_dir . 'bp-core/bp-core-moderation.php' ); 437 require( $this->plugin_dir . 'bp-core/bp-core-loader.php' ); 438 439 // Skip or load deprecated content 440 if ( false !== $this->load_deprecated ) { 441 require( $this->plugin_dir . 'bp-core/deprecated/1.5.php' ); 442 require( $this->plugin_dir . 'bp-core/deprecated/1.6.php' ); 443 require( $this->plugin_dir . 'bp-core/deprecated/1.7.php' ); 444 } 378 // Theme compatability 379 require( $this->plugin_dir . 'bp-core/bp-core-template-loader.php' ); 380 require( $this->plugin_dir . 'bp-core/bp-core-theme-compatibility.php' ); 381 382 // Require all of the BuddyPress core libraries 383 require( $this->plugin_dir . 'bp-core/bp-core-dependency.php' ); 384 require( $this->plugin_dir . 'bp-core/bp-core-actions.php' ); 385 require( $this->plugin_dir . 'bp-core/bp-core-caps.php' ); 386 require( $this->plugin_dir . 'bp-core/bp-core-cache.php' ); 387 require( $this->plugin_dir . 'bp-core/bp-core-cssjs.php' ); 388 require( $this->plugin_dir . 'bp-core/bp-core-update.php' ); 389 require( $this->plugin_dir . 'bp-core/bp-core-options.php' ); 390 require( $this->plugin_dir . 'bp-core/bp-core-classes.php' ); 391 require( $this->plugin_dir . 'bp-core/bp-core-filters.php' ); 392 require( $this->plugin_dir . 'bp-core/bp-core-avatars.php' ); 393 require( $this->plugin_dir . 'bp-core/bp-core-widgets.php' ); 394 require( $this->plugin_dir . 'bp-core/bp-core-template.php' ); 395 require( $this->plugin_dir . 'bp-core/bp-core-adminbar.php' ); 396 require( $this->plugin_dir . 'bp-core/bp-core-buddybar.php' ); 397 require( $this->plugin_dir . 'bp-core/bp-core-catchuri.php' ); 398 require( $this->plugin_dir . 'bp-core/bp-core-component.php' ); 399 require( $this->plugin_dir . 'bp-core/bp-core-functions.php' ); 400 require( $this->plugin_dir . 'bp-core/bp-core-moderation.php' ); 401 require( $this->plugin_dir . 'bp-core/bp-core-loader.php' ); 402 403 // Skip or load deprecated content 404 if ( false !== $this->load_deprecated ) { 405 require( $this->plugin_dir . 'bp-core/deprecated/1.5.php' ); 406 require( $this->plugin_dir . 'bp-core/deprecated/1.6.php' ); 407 require( $this->plugin_dir . 'bp-core/deprecated/1.7.php' ); 445 408 } 446 409 }
Note: See TracChangeset
for help on using the changeset viewer.