Changeset 3706
- Timestamp:
- 01/14/2011 07:35:58 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core.php
r3675 r3706 299 299 require ( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-admin.php' ); 300 300 } 301 add_action( 'admin_menu', 'bp_core_admin_menu_init' );301 is_multisite() ? add_action( 'network_admin_menu', 'bp_core_admin_menu_init' ) : add_action( 'admin_menu', 'bp_core_admin_menu_init' ); 302 302 303 303 /** … … 315 315 return false; 316 316 317 / * Add the administration tab under the "Site Admin" tab for site administrators */317 // Add the administration tab under the "Site Admin" tab for site administrators 318 318 $hook = bp_core_add_admin_menu_page( array( 319 'menu_title' => __( 'BuddyPress', 'buddypress' ), 320 'page_title' => __( 'BuddyPress', 'buddypress' ), 321 'access_level' => 10, 'file' => 'bp-general-settings', 322 'function' => 'bp_core_admin_dashboard', 323 'position' => 2 319 'menu_title' => __( 'BuddyPress', 'buddypress' ), 320 'page_title' => __( 'BuddyPress', 'buddypress' ), 321 'capability' => 'manage_options', 322 'file' => 'bp-general-settings', 323 'function' => 'bp_core_admin_dashboard', 324 'position' => 2 324 325 ) ); 325 326 326 327 add_submenu_page( 'bp-general-settings', __( 'BuddyPress Dashboard', 'buddypress' ), __( 'Dashboard', 'buddypress' ), 'manage_options', 'bp-general-settings', 'bp_core_admin_dashboard' ); 327 add_submenu_page( 'bp-general-settings', __( 'Settings', 'buddypress' ), __( 'Settings', 'buddypress' ), 'manage_options', 'bp-settings', 'bp_core_admin_settings');328 329 / * Add a hook for css/js */328 add_submenu_page( 'bp-general-settings', __( 'Settings', 'buddypress' ), __( 'Settings', 'buddypress' ), 'manage_options', 'bp-settings', 'bp_core_admin_settings' ); 329 330 // Add a hook for css/js 330 331 add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' ); 331 332 } 332 add_action( 'admin_menu', 'bp_core_add_admin_menu' );333 is_multisite() ? add_action( 'network_admin_menu', 'bp_core_add_admin_menu' ) : add_action( 'admin_menu', 'bp_core_add_admin_menu' ); 333 334 334 335 /** … … 1816 1817 1817 1818 $defaults = array( 1818 'page_title' => '',1819 'menu_title' => '',1820 ' access_level' => 2,1821 'file' => false,1822 'function' => false,1823 'icon_url' => false,1824 'position' => 1001819 'page_title' => '', 1820 'menu_title' => '', 1821 'capability' => 'manage_options', 1822 'file' => false, 1823 'function' => false, 1824 'icon_url' => false, 1825 'position' => 100 1825 1826 ); 1826 1827 … … 1845 1846 } while ( !empty( $menu[$position] ) ); 1846 1847 1847 $menu[$position] = array ( $menu_title, $ access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );1848 $menu[$position] = array ( $menu_title, $capability, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); 1848 1849 1849 1850 $_registered_pages[$hookname] = true; -
trunk/bp-core/admin/bp-core-upgrade.php
r3613 r3706 53 53 54 54 function bp_core_setup_wizard() { 55 if ( !$this->current_version = get_site_option( 'bp-db-version' ) ) 56 if ( $this->current_version = get_option( 'bp-db-version' ) ) 55 // Look for current DB version 56 if ( !$this->current_version = get_site_option( 'bp-db-version' ) ) { 57 if ( $this->current_version = get_option( 'bp-db-version' ) ) { 57 58 $this->is_network_activate = true; 58 59 $this->new_version = constant( 'BP_DB_VERSION' ); 60 $this->setup_type = ( empty( $this->current_version ) && !(int)get_site_option( 'bp-core-db-version' ) ) ? 'new' : 'upgrade'; 59 } else { 60 setcookie( 'bp-wizard-step', 0, time() + 60 * 60 * 24, COOKIEPATH ); 61 $_COOKIE['bp-wizard-step'] = 0; 62 } 63 } 64 65 $this->new_version = constant( 'BP_DB_VERSION' ); 66 $this->setup_type = ( empty( $this->current_version ) && !(int)get_site_option( 'bp-core-db-version' ) ) ? 'new' : 'upgrade'; 61 67 $this->current_step = $this->current_step(); 62 68 63 / * Call the save method that will save data and modify $current_step */69 // Call the save method that will save data and modify $current_step 64 70 if ( isset( $_POST['save'] ) ) 65 71 $this->save( $_POST['save'] ); 66 72 67 / * Build the steps needed for upgrade or new installations */73 // Build the steps needed for upgrade or new installations 68 74 $this->steps = $this->add_steps(); 69 75 } … … 121 127 122 128 function save( $step_name ) { 123 / * Save any posted values */129 // Save any posted values 124 130 switch ( $step_name ) { 125 131 case 'db_upgrade': default: … … 185 191 </div> 186 192 187 <?php do_action( 'bp_admin_notices' ) ?> 188 189 <form action="<?php echo site_url( '/wp-admin/admin.php?page=bp-wizard' ) ?>" method="post" id="bp-admin-form"> 193 <?php 194 do_action( 'bp_admin_notices' ); 195 $step_count = count( $this->steps ) - 1; 196 $wiz_or_set = $this->current_step >= $step_count ? 'bp-general-settings' : 'bp-wizard'; 197 $form_action = is_multisite() ? network_admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'admin.php' ) ) : admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'admin.php' ) ); 198 ?> 199 200 <form action="<?php echo $form_action; ?>" method="post" id="bp-admin-form"> 190 201 <div id="bp-admin-content"> 191 202 <?php switch ( $this->steps[$this->current_step] ) { … … 489 500 490 501 <?php if ( 'new' == $this->setup_type ) : ?> 502 491 503 <p><?php _e( "BuddyPress needs to use pages to display content and directories.", 'buddypress' ) ?></p> 504 492 505 <?php else : ?> 506 493 507 <p><?php _e( "New versions of BuddyPress use WordPress pages to display content. This allows you to easily change the names of pages or move them to a sub page.", 'buddypress' ) ?></p> 508 494 509 <?php endif; ?> 495 510 … … 506 521 </th> 507 522 <td> 508 <p><input type="radio" name="bp_pages[members]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-members-page&echo=0&show_option_none=" .__('- Select -')."&selected=" . $existing_pages['members'] ) ?></p>509 <p><input type="radio" name="bp_pages[members]" checked="checked" value="<?php echo $members_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo site_url( $members_slug ) ?>/</p>523 <p><input type="radio" name="bp_pages[members]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-members-page&echo=0&show_option_none=" . __('- Select -') . "&selected=" . $existing_pages['members'] ) ?></p> 524 <p><input type="radio" name="bp_pages[members]" checked="checked" value="<?php echo $members_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $members_slug ) ?>/</p> 510 525 </td> 511 526 </tr> 512 527 513 528 <?php if ( !isset( $disabled_components['bp-activity.php'] ) ) : ?> 514 <tr valign="top"> 515 <th scope="row"> 516 <h5><?php _e( 'Site Activity', 'buddypress' ) ?></h5> 517 <p><?php _e( "Displays the activity for the entire site, a member's friends, groups and @mentions.", 'buddypress' ) ?></p> 518 </th> 519 <td> 520 <p><input type="radio" name="bp_pages[activity]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-activity-page&echo=0&show_option_none=".__('- Select -')."&selected=" . $existing_pages['activity'] ) ?></p> 521 <p><input type="radio" name="bp_pages[activity]" checked="checked" value="<?php echo $activity_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo site_url( $activity_slug ) ?>/</p> 522 </td> 523 </tr> 529 530 <tr valign="top"> 531 <th scope="row"> 532 <h5><?php _e( 'Site Activity', 'buddypress' ) ?></h5> 533 <p><?php _e( "Displays the activity for the entire site, a member's friends, groups and @mentions.", 'buddypress' ) ?></p> 534 </th> 535 <td> 536 <p><input type="radio" name="bp_pages[activity]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-activity-page&echo=0&show_option_none=" . __('- Select -') . "&selected=" . $existing_pages['activity'] ) ?></p> 537 <p><input type="radio" name="bp_pages[activity]" checked="checked" value="<?php echo $activity_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $activity_slug ) ?>/</p> 538 </td> 539 </tr> 540 524 541 <?php endif; ?> 525 542 526 543 <?php if ( !isset( $disabled_components['bp-groups.php'] ) ) : ?> 527 <tr valign="top"> 528 <th scope="row"> 529 <h5><?php _e( 'Groups', 'buddypress' ) ?></h5> 530 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ) ?></p> 531 </th> 532 <td> 533 <p><input type="radio" name="bp_pages[groups]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-groups-page&echo=0&show_option_none=".__('- Select -')."&selected=" . $existing_pages['groups'] ) ?></p> 534 <p><input type="radio" name="bp_pages[groups]" checked="checked" value="<?php echo $groups_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo site_url( $groups_slug ) ?>/</p> 535 </td> 536 </tr> 544 545 <tr valign="top"> 546 <th scope="row"> 547 <h5><?php _e( 'Groups', 'buddypress' ) ?></h5> 548 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ) ?></p> 549 </th> 550 <td> 551 <p><input type="radio" name="bp_pages[groups]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-groups-page&echo=0&show_option_none=" . __('- Select -') . "&selected=" . $existing_pages['groups'] ) ?></p> 552 <p><input type="radio" name="bp_pages[groups]" checked="checked" value="<?php echo $groups_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $groups_slug ) ?>/</p> 553 </td> 554 </tr> 555 537 556 <?php endif; ?> 538 557 539 558 <?php if ( !isset( $disabled_components['bp-forums.php'] ) ) : ?> 540 <tr valign="top"> 541 <th scope="row"> 542 <h5><?php _e( 'Forums', 'buddypress' ) ?></h5> 543 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ) ?></p> 544 </th> 545 <td> 546 <p><input type="radio" name="bp_pages[forums]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-forums-page&echo=0&show_option_none=".__('- Select -')."&selected=" . $existing_pages['forums'] ) ?></p> 547 <p><input type="radio" name="bp_pages[forums]" checked="checked" value="<?php echo $forums_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo site_url( $forums_slug ) ?>/</p> 548 </td> 549 </tr> 559 560 <tr valign="top"> 561 <th scope="row"> 562 <h5><?php _e( 'Forums', 'buddypress' ) ?></h5> 563 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ) ?></p> 564 </th> 565 <td> 566 <p><input type="radio" name="bp_pages[forums]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-forums-page&echo=0&show_option_none=" . __('- Select -') . "&selected=" . $existing_pages['forums'] ) ?></p> 567 <p><input type="radio" name="bp_pages[forums]" checked="checked" value="<?php echo $forums_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $forums_slug ) ?>/</p> 568 </td> 569 </tr> 570 550 571 <?php endif; ?> 551 572 552 573 <?php if ( is_multisite() && !isset( $disabled_components['bp-blogs.php'] ) ) : ?> 553 <tr valign="top"> 554 <th scope="row"> 555 <h5><?php _e( 'Blogs', 'buddypress' ) ?></h5> 556 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ) ?></p> 557 </th> 558 <td> 559 <p><input type="radio" name="bp_pages[blogs]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-blogs-page&echo=0&show_option_none=".__('- Select -')."&selected=" . $existing_pages['blogs'] ) ?></p> 560 <p><input type="radio" name="bp_pages[blogs]" checked="checked" value="<?php echo $blogs_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo site_url( $blogs_slug ) ?>/</p> 561 </td> 562 </tr> 574 575 <tr valign="top"> 576 <th scope="row"> 577 <h5><?php _e( 'Blogs', 'buddypress' ) ?></h5> 578 <p><?php _e( 'Displays individual groups as well as a directory of groups.', 'buddypress' ) ?></p> 579 </th> 580 <td> 581 <p><input type="radio" name="bp_pages[blogs]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-blogs-page&echo=0&show_option_none=" . __('- Select -') . "&selected=" . $existing_pages['blogs'] ) ?></p> 582 <p><input type="radio" name="bp_pages[blogs]" checked="checked" value="<?php echo $blogs_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $blogs_slug ) ?>/</p> 583 </td> 584 </tr> 585 563 586 <?php endif; ?> 564 587 … … 569 592 </th> 570 593 <td> 571 <p><input type="radio" name="bp_pages[register]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-register-page&echo=0&show_option_none=" .__('- Select -')."&selected=" . $existing_pages['register'] ) ?></p>572 <p><input type="radio" name="bp_pages[register]" checked="checked" value="<?php echo $register_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo site_url( $register_slug ) ?>/</p>594 <p><input type="radio" name="bp_pages[register]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-register-page&echo=0&show_option_none=" . __('- Select -') . "&selected=" . $existing_pages['register'] ) ?></p> 595 <p><input type="radio" name="bp_pages[register]" checked="checked" value="<?php echo $register_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $register_slug ) ?>/</p> 573 596 </td> 574 597 </tr> … … 580 603 </th> 581 604 <td> 582 <p><input type="radio" name="bp_pages[activate]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-activate-page&echo=0&show_option_none=" .__('- Select -')."&selected=" . $existing_pages['activate'] ) ?></p>583 <p><input type="radio" name="bp_pages[activate]" checked="checked" value="<?php echo $activation_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo site_url( $activation_slug ) ?>/</p>605 <p><input type="radio" name="bp_pages[activate]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ) ?> <?php echo wp_dropdown_pages("name=bp-activate-page&echo=0&show_option_none=" . __('- Select -') . "&selected=" . $existing_pages['activate'] ) ?></p> 606 <p><input type="radio" name="bp_pages[activate]" checked="checked" value="<?php echo $activation_slug ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $activation_slug ) ?>/</p> 584 607 </td> 585 608 </tr> … … 591 614 <input type="hidden" name="save" value="pages" /> 592 615 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ) ?>" /> 616 593 617 <?php wp_nonce_field( 'bpwizard_pages' )?> 618 594 619 </div> 595 620 … … 753 778 <input type="hidden" name="save" value="theme" /> 754 779 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ) ?>" /> 780 755 781 <?php wp_nonce_field( 'bpwizard_theme' ) ?> 782 756 783 </div> 757 784 … … 773 800 774 801 <?php if ( 'new' == $this->setup_type ) : 775 $type = __( 'setup', 'buddypress' ); 776 ?> 802 $type = __( 'setup', 'buddypress' ); ?> 803 777 804 <h2>Setup Complete!</h2> 805 778 806 <?php else : 779 $type = __( 'upgrade', 'buddypress' ); 780 ?> 807 $type = __( 'upgrade', 'buddypress' ); ?> 808 781 809 <h2>Upgrade Complete!</h2> 810 782 811 <?php endif; ?> 783 812 … … 790 819 <input type="hidden" name="save" value="finish" /> 791 820 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ) ?>" /> 821 792 822 <?php wp_nonce_field( 'bpwizard_finish' ) ?> 823 793 824 </div> 794 825 … … 991 1022 check_admin_referer( 'bpwizard_theme' ); 992 1023 1024 // Update the DB version in the database 1025 update_site_option( 'bp-db-version', constant( 'BP_DB_VERSION' ) ); 1026 delete_site_option( 'bp-core-db-version' ); 1027 993 1028 require_once( ABSPATH . WPINC . '/plugin.php' ); 994 1029 $installed_plugins = get_plugins(); … … 996 1031 switch ( $_POST['theme'] ) { 997 1032 case 'bp_default': 998 / * Activate the bp-default theme */1033 // Activate the bp-default theme 999 1034 switch_theme( 'bp-default', 'bp-default' ); 1000 1035 break; … … 1030 1065 check_admin_referer( 'bpwizard_finish' ); 1031 1066 1032 /* Update the DB version in the database */ 1033 update_site_option( 'bp-db-version', constant( 'BP_DB_VERSION' ) ); 1034 delete_site_option( 'bp-core-db-version' ); 1035 1036 /* Delete the setup cookie */ 1067 // Delete the setup cookie 1037 1068 @setcookie( 'bp-wizard-step', '', time() - 3600, COOKIEPATH ); 1038 1069 1039 /* Redirect to the BuddyPress dashboard */ 1040 wp_redirect( admin_url( 'admin.php?page=bp-general-settings' ) ); 1070 // Redirect to the BuddyPress dashboard 1071 $redirect = is_multisite() ? network_admin_url( add_query_arg( array( 'page' => 'bp-general-settings' ) ) ) : admin_url( add_query_arg( array( 'page' => 'bp-general-settings' ) ) ); 1072 1073 wp_redirect( $redirect ); 1041 1074 1042 1075 return true; … … 1049 1082 foreach ( $pages as $key => $value ) { 1050 1083 if ( 'page' == $value ) { 1051 / * Check for the selected page */1084 // Check for the selected page 1052 1085 if ( !empty( $_POST['bp-' . $key . '-page'] ) ) 1053 1086 $bp_pages[$key] = (int)$_POST['bp-' . $key . '-page']; … … 1055 1088 $bp_pages[$key] = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords( $key ), 'post_status' => 'publish', 'post_type' => 'page' ) ); 1056 1089 } else { 1057 / * Create a new page */1090 // Create a new page 1058 1091 $bp_pages[$key] = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords( $value ), 'post_status' => 'publish', 'post_type' => 'page' ) ); 1059 1092 } … … 1065 1098 /* Database upgrade methods based on version numbers */ 1066 1099 function upgrade_1_3() { 1067 / * Run the schema install to upgrade tables */1100 // Run the schema install to upgrade tables 1068 1101 bp_core_install(); 1069 1102 1070 / * Delete old database version options */1103 // Delete old database version options 1071 1104 delete_site_option( 'bp-activity-db-version' ); 1072 1105 delete_site_option( 'bp-blogs-db-version' ); … … 1076 1109 delete_site_option( 'bp-xprofile-db-version' ); 1077 1110 } 1111 1112 /** 1113 * Reset the cookie so the install script starts over 1114 */ 1115 function reset_cookie() { 1116 @setcookie( 'bp-wizard-step', '', time() - 3600, COOKIEPATH ); 1117 } 1078 1118 } 1079 1119 … … 1083 1123 $bp_wizard = new BP_Core_Setup_Wizard; 1084 1124 } 1085 add_action( 'admin_menu', 'bp_core_setup_wizard_init' ); 1125 is_multisite() ? add_action( 'network_admin_menu', 'bp_core_setup_wizard_init' ) : add_action( 'admin_menu', 'bp_core_setup_wizard_init' ); 1126 1086 1127 1087 1128 function bp_core_install( $disabled = false ) { … … 1093 1134 require_once( dirname( __FILE__ ) . '/bp-core-schema.php' ); 1094 1135 1095 / * Core DB Tables */1136 // Core DB Tables 1096 1137 bp_core_install_notifications(); 1097 1138 1098 / * Activity Streams */1139 // Activity Streams 1099 1140 if ( empty( $disabled['bp-activity.php'] ) ) 1100 1141 bp_core_install_activity_streams(); 1101 1142 1102 / * Friend Connections */1143 // Friend Connections 1103 1144 if ( empty( $disabled['bp-friends.php'] ) ) 1104 1145 bp_core_install_friends(); 1105 1146 1106 / * Extensible Groups */1147 // Extensible Groups 1107 1148 if ( empty( $disabled['bp-groups.php'] ) ) 1108 1149 bp_core_install_groups(); 1109 1150 1110 / * Private Messaging */1151 // Private Messaging 1111 1152 if ( empty( $disabled['bp-messages.php'] ) ) 1112 1153 bp_core_install_private_messaging(); 1113 1154 1114 / * Extended Profiles */1155 // Extended Profiles 1115 1156 if ( empty( $disabled['bp-xprofile.php'] ) ) 1116 1157 bp_core_install_extended_profiles(); 1117 1158 1118 / * Only install blog tables if this is a multisite installation */1159 // Only install blog tables if this is a multisite installation 1119 1160 if ( is_multisite() && empty( $disabled['bp-blogs.php'] ) ) 1120 1161 bp_core_install_blog_tracking(); … … 1128 1169 1129 1170 function bp_upgrade_db_stuff() { 1130 / * Rename the old user activity cached table if needed. */1171 // Rename the old user activity cached table if needed. 1131 1172 if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$wpdb->base_prefix}bp_activity_user_activity_cached%'" ) ) 1132 1173 $wpdb->query( "RENAME TABLE {$wpdb->base_prefix}bp_activity_user_activity_cached TO {$bp->activity->table_name}" ); 1133 1174 1134 / * Rename fields from pre BP 1.2 */1175 // Rename fields from pre BP 1.2 1135 1176 if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->activity->table_name}%'" ) ) { 1136 1177 if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->activity->table_name} LIKE 'component_action'" ) ) … … 1150 1191 bp_core_add_illegal_names(); 1151 1192 1152 / * Upgrade and remove the message threads table if it exists */1193 // Upgrade and remove the message threads table if it exists 1153 1194 if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$wpdb->base_prefix}bp_messages_threads%'" ) ) { 1154 1195 $upgrade = BP_Messages_Thread::upgrade_tables(); … … 1171 1212 1172 1213 $defaults = array( 1173 'page_title' => '',1174 'menu_title' => '',1175 ' access_level' => 2,1176 ' file' => false,1177 'function' => false,1178 'icon_url' => false,1179 'position' => 1001214 'page_title' => '', 1215 'menu_title' => '', 1216 'capability' => 'manage_options', 1217 'menu_slug' => '', 1218 'function' => false, 1219 'icon_url' => false, 1220 'position' => 100 1180 1221 ); 1181 1222 … … 1183 1224 extract( $r, EXTR_SKIP ); 1184 1225 1185 $file = plugin_basename( $file ); 1186 1187 $admin_page_hooks[$file] = sanitize_title( $menu_title ); 1188 1189 $hookname = get_plugin_page_hookname( $file, '' ); 1190 if ( ! empty( $function ) && !empty ( $hookname ) ) 1191 add_action( $hookname, $function ); 1192 1193 if ( empty($icon_url) ) 1194 $icon_url = 'images/generic.png'; 1195 elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') ) 1196 $icon_url = 'https://' . substr($icon_url, 7); 1197 1198 do { 1199 $position++; 1200 } while ( !empty( $menu[$position] ) ); 1201 1202 $menu[$position] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); 1203 1204 $_registered_pages[$hookname] = true; 1205 1206 return $hookname; 1226 if ( is_multisite() ) 1227 add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); 1228 else 1229 add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); 1207 1230 } 1208 1231 … … 1261 1284 $status = __( 'Upgrade', 'buddypress' ); 1262 1285 1263 / * Add the administration tab under the "Site Admin" tab for site administrators */1286 // Add the administration tab under the "Site Admin" tab for site administrators 1264 1287 bp_core_add_admin_menu_page( array( 1265 'menu_title' => __( 'BuddyPress', 'buddypress' ), 1266 'page_title' => __( 'BuddyPress', 'buddypress' ), 1267 'access_level' => 10, 'file' => 'bp-wizard', 1268 'function' => '', 1269 'position' => 2 1288 'menu_title' => __( 'BuddyPress', 'buddypress' ), 1289 'page_title' => __( 'BuddyPress', 'buddypress' ), 1290 'capability' => 'manage_options', 1291 'menu_slug' => 'bp-wizard', 1292 'function' => '', 1293 'position' => 3 1270 1294 ) ); 1271 1295 1272 1296 $hook = add_submenu_page( 'bp-wizard', $status, $status, 'manage_options', 'bp-wizard', array( $bp_wizard, 'html' ) ); 1273 1297 1274 / * Add a hook for css/js */1298 // Add a hook for css/js 1275 1299 add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' ); 1276 1300 } 1277 add_action( 'admin_menu', 'bp_core_add_admin_menu' );1301 is_multisite() ? add_action( 'network_admin_menu', 'bp_core_add_admin_menu' ) : add_action( 'admin_menu', 'bp_core_add_admin_menu' ); 1278 1302 1279 1303 function bp_core_add_admin_menu_styles() { … … 1287 1311 ?> 1288 1312 <style type="text/css"> 1313 /* Wizard Icon */ 1314 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a img { display: none; } 1289 1315 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a { background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px; } 1290 ul#adminmenu li.toplevel_page_bp-wizard:hover .wp-menu-image a { background-position: -1px 0; } 1291 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a img { display: none; } 1316 ul#adminmenu li.toplevel_page_bp-wizard:hover .wp-menu-image a, 1317 ul#adminmenu li.toplevel_page_bp-wizard.wp-has-current-submenu .wp-menu-image a { 1318 background-position: -1px 0; 1319 } 1320 1321 /* Settings Icon */ 1322 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img { display: none; } 1323 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a { background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px; } 1324 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a, 1325 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a { 1326 background-position: -1px 0; 1327 } 1292 1328 </style> 1293 1329 <?php 1294 1330 } 1331 add_action( 'admin_head', 'bp_core_add_admin_menu_styles' ); 1295 1332 ?> -
trunk/bp-core/bp-core-cssjs.php
r3702 r3706 34 34 */ 35 35 function bp_core_admin_menu_icon_css() { 36 global $bp; 37 ?> 36 global $bp; ?> 38 37 39 38 <style type="text/css"> 40 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a { background-image: url( <?php echo BP_PLUGIN_URL . '/bp-core/images/admin_menu_icon.png' ?> ) !important; background-position: -1px -32px; } 41 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a, ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a { background-position: -1px 0; } 39 /* Wizard Icon */ 40 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a img { display: none; } 41 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a { background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px; } 42 ul#adminmenu li.toplevel_page_bp-wizard:hover .wp-menu-image a, 43 ul#adminmenu li.toplevel_page_bp-wizard.wp-has-current-submenu .wp-menu-image a { 44 background-position: -1px 0; 45 } 46 47 /* Settings Icon */ 42 48 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img { display: none; } 49 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a { background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px; } 50 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a, 51 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a { 52 background-position: -1px 0; 53 } 43 54 </style> 44 55 … … 85 96 $image = apply_filters( 'bp_inline_cropper_image', getimagesize( BP_AVATAR_UPLOAD_PATH . $bp->avatar_admin->image->dir ) ); 86 97 $aspect_ratio = 1; 98 99 $full_height = (int) constant( 'BP_AVATAR_FULL_HEIGHT' ); 100 $full_width = (int) constant( 'BP_AVATAR_FULL_WIDTH' ); 87 101 88 102 // Calculate Aspect Ratio 89 if ( (int) constant( 'BP_AVATAR_FULL_HEIGHT' ) && ( (int) constant( 'BP_AVATAR_FULL_WIDTH' ) != (int) constant( 'BP_AVATAR_FULL_HEIGHT' )) )90 $aspect_ratio = (int) constant( 'BP_AVATAR_FULL_WIDTH' ) / (int) constant( 'BP_AVATAR_FULL_HEIGHT' );103 if ( $full_height && ( $full_width != $full_height ) ) 104 $aspect_ratio = $full_width / $full_height; 91 105 92 106 $width = $image[0] / 2; … … 115 129 function showPreview(coords) { 116 130 if ( parseInt(coords.w) > 0 ) { 117 var rx = <?php echo (int) constant( 'BP_AVATAR_FULL_WIDTH' )?> / coords.w;118 var ry = <?php echo (int) constant( 'BP_AVATAR_FULL_HEIGHT' )?> / coords.h;131 var rx = <?php echo $full_width; ?> / coords.w; 132 var ry = <?php echo $full_height; ?> / coords.h; 119 133 120 134 jQuery('#avatar-crop-preview').css({ 121 135 <?php if ( $image ) : ?> 122 width: Math.round(rx * <?php echo $image[0] ?>) + 'px',123 height: Math.round(ry * <?php echo $image[1] ?>) + 'px',136 width: Math.round(rx * <?php echo $image[0]; ?>) + 'px', 137 height: Math.round(ry * <?php echo $image[1]; ?>) + 'px', 124 138 <?php endif; ?> 125 139 marginLeft: '-' + Math.round(rx * coords.x) + 'px',
Note: See TracChangeset
for help on using the changeset viewer.