Skip to:
Content

BuddyPress.org

Ticket #3708: 3708-1.patch

File 3708-1.patch, 12.2 KB (added by DJPaul, 11 years ago)
  • bp-xprofile/bp-xprofile-admin.php

     
    2222        if ( !is_super_admin() )
    2323                return false;
    2424
    25         $hook = add_submenu_page( 'bp-general-settings', __( 'Profile Fields', 'buddypress' ), __( 'Profile Fields', 'buddypress' ), 'manage_options', 'bp-profile-setup', 'xprofile_admin' );
     25        $hook = add_users_page( __( 'Profile Fields', 'buddypress' ), __( 'Profile Fields', 'buddypress' ), 'manage_options', 'bp-profile-setup', 'xprofile_admin' );
    2626
    2727        add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' );
    2828}
     
    7171
    7272                <h2>
    7373
    74                         <?php _e( 'Extended Profile Fields', 'buddypress'); ?>
     74                        <?php _e( 'Profile Fields', 'buddypress'); ?>
    7575
    7676                        <a id="add_group" class="button add-new-h2" href="admin.php?page=bp-profile-setup&amp;mode=add_group"><?php _e( 'Add New Group', 'buddypress' ); ?></a>
    7777                </h2>
  • bp-core/bp-core-functions.php

     
    230230add_action( 'bp_init', 'bp_core_admin_menu_init' );
    231231
    232232/**
     233 * In BP 1.6, the top-level admin menu was removed. This change could break old
     234 * third-party plugins, so this function keeps the top-level menu if a plugin
     235 * has registered a menu into the old 'bp-general-settings' menu.
     236 *
     237 * The old "bp-general-settings" page was renamed "bp-general-config".
     238 *
     239 * @global array $_parent_pages
     240 * @global array $_registered_pages
     241 * @global array $submenu
     242 * @since 1.6
     243 */
     244function bp_core_admin_backpat_menu() {
     245        global $_registered_pages, $_parent_pages, $submenu;
     246
     247        if ( !is_super_admin() )
     248                return;
     249
     250        // Don't do anything if a BP upgrade is in progress, or if the bp-wizard is in progress.
     251        if ( defined( 'BP_IS_UPGRADE' ) && BP_IS_UPGRADE || empty( $submenu['bp-general-settings'] ) )
     252                return;
     253
     254        /**
     255         * If only the default backpat item is present, then don't show the top-level BuddyPress menu.
     256         * This means that no third-party plugins have registered their admin pages into the
     257         * 'bp-general-settings' menu.
     258         */
     259        if ( 1 == count( $submenu['bp-general-settings'] ) ) {
     260                // This removes the top-level menu
     261                remove_submenu_page( 'bp-general-settings', 'bp-general-settings' );
     262                remove_menu_page( 'bp-general-settings' );
     263
     264                // These stop people accessing the URL directly
     265                if ( isset( $_parent_pages['bp-general-settings'] ) )
     266                        unset( $_parent_pages['bp-general-settings'] );
     267
     268                if ( isset( $_registered_pages['toplevel_page_bp-general-settings'] ) )
     269                        unset( $_registered_pages['toplevel_page_bp-general-settings'] );
     270        }
     271}
     272add_action( bp_core_admin_hook(), 'bp_core_admin_backpat_menu', 99999 );
     273
     274/**
    233275 * Adds the "BuddyPress" admin submenu item to the Site Admin tab.
    234276 *
    235277 * @package BuddyPress Core
    236278 * @global object $bp Global BuddyPress settings object
    237279 * @uses is_super_admin() returns true if the current user is a site admin, false if not
    238  * @uses add_submenu_page() WP function to add a submenu item
    239280 */
    240281function bp_core_add_admin_menu() {
    241282        if ( !is_super_admin() )
     
    248289
    249290        $hooks = array();
    250291
    251         // Add the administration tab under the "Site Admin" tab for site administrators
    252         $hooks[] = add_menu_page( __( 'BuddyPress', 'buddypress' ), __( 'BuddyPress', 'buddypress' ), 'manage_options', 'bp-general-settings', 'bp_core_admin_component_setup', '' );
    253         $hooks[] = add_submenu_page( 'bp-general-settings', __( 'Components', 'buddypress' ), __( 'Components', 'buddypress' ), 'manage_options', 'bp-general-settings', 'bp_core_admin_component_setup'  );
    254         $hooks[] = add_submenu_page( 'bp-general-settings', __( 'Pages',      'buddypress' ), __( 'Pages',      'buddypress' ), 'manage_options', 'bp-page-settings',    'bp_core_admin_page_setup'       );
    255         $hooks[] = add_submenu_page( 'bp-general-settings', __( 'Settings',   'buddypress' ), __( 'Settings',   'buddypress' ), 'manage_options', 'bp-settings',         'bp_core_admin_settings'         );
     292        // Changed in BP 1.6 . See bp_core_admin_backpat_menu()
     293        $hooks[] = add_menu_page( __( 'BuddyPress', 'buddypress' ), __( 'BuddyPress', 'buddypress' ), 'manage_options', 'bp-general-settings', 'bp_core_admin_backpat_menu', '' );
     294        $hooks[] = add_submenu_page( 'bp-general-settings', __( 'BuddyPress Help', 'buddypress' ), __( 'Help', 'buddypress' ), 'manage_options', 'bp-general-settings', 'bp_core_admin_backpat_page'  );
    256295
     296        // Add the option pages
     297        $hooks[] = add_options_page( __( 'BP Components', 'buddypress' ), __( 'BP Components', 'buddypress' ), 'manage_options', 'bp-general-config',   'bp_core_admin_component_setup'  );
     298        $hooks[] = add_options_page( __( 'BP Pages',      'buddypress' ), __( 'BP Pages',      'buddypress' ), 'manage_options', 'bp-page-settings',    'bp_core_admin_page_setup'       );
     299        $hooks[] = add_options_page( __( 'BP Settings',   'buddypress' ), __( 'BP Settings',   'buddypress' ), 'manage_options', 'bp-settings',         'bp_core_admin_settings'         );
     300
    257301        // Add a hook for css/js
    258302        foreach( $hooks as $hook )
    259303                add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' );
  • bp-core/admin/bp-core-admin.php

     
    2828        // Setup core admin tabs
    2929        $tabs = array(
    3030                '0' => array(
    31                         'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-general-settings' ), 'admin.php' ) ),
     31                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-general-config' ), 'admin.php' ) ),
    3232                        'name' => __( 'Components', 'buddypress' )
    3333                ),
    3434                '1' => array(
     
    6464}
    6565
    6666/**
     67 * Generates markup for a fallback top-level BuddyPress menu page, if the site is running
     68 * a legacy plugin which hasn't been updated. If the site is up to date, this page
     69 * will never appear.
     70 *
     71 * @see bp_core_admin_backpat_menu()
     72 * @since 1.6
     73 * @todo Add convenience links into the markup once new positions are finalised.
     74 */
     75function bp_core_admin_backpat_page() {
     76?>
     77        <div class="wrap">
     78                <h2><?php _e( 'Why have all my BuddyPress menus disappeared?', 'buddypress' ); ?></h2>
     79
     80                <p><?php _e( "Don't worry! We've moved the BuddyPress options into more appropriate locations in the admin menu. You're seeing this page because you are running a legacy BuddyPress plugin which has not been updated.", 'buddypress' ); ?></p>
     81                <p>TODO: Add convenience links into the markup once new positions are finalised.</p>
     82
     83                <!--
     84                <p><?php printf( __( 'To create or edit user profile fields, go to: <a href="">Components</a>', 'buddypress' ), '#' ); ?></p>
     85                <p><?php printf( __( 'To create or edit user profile fields, go to: <a href="">Pages</a>', 'buddypress' ), '#' ); ?></p>
     86                <p><?php printf( __( 'To create or edit user profile fields, go to: <a href="">Settings</a>', 'buddypress' ), '#' ); ?></p>
     87                <p><?php printf( __( 'To create or edit user profile fields, go to: <a href="">Forums</a>', 'buddypress' ), '#' ); ?></p>
     88                <p><?php printf( __( 'To create or edit user profile fields, go to: <a href="">Profile Fields</a>', 'buddypress' ), '#' ); ?></p>
     89                -->
     90        </div>
     91<?php
     92}
     93
     94/**
    6795 * Renders the Settings admin panel.
    6896 *
    6997 * @package BuddyPress Core
     
    217245                        bp_update_option( 'bp-active-components', $bp->active_components );
    218246                }
    219247
    220                 $base_url = bp_get_admin_url(  add_query_arg( array( 'page' => 'bp-general-settings', 'updated' => 'true' ), 'admin.php' ) );
     248                $base_url = bp_get_admin_url(  add_query_arg( array( 'page' => 'bp-general-config', 'updated' => 'true' ), 'admin.php' ) );
    221249
    222250                wp_redirect( $base_url );
    223251        }
  • bp-core/admin/bp-core-update.php

     
    166166                                do_action( 'bp_admin_notices' );
    167167
    168168                                $step_count  = count( $this->steps ) - 1;
    169                                 $wiz_or_set  = $this->current_step >= $step_count ? 'bp-general-settings' : 'bp-wizard';
     169                                $wiz_or_set  = $this->current_step >= $step_count ? 'bp-general-config' : 'bp-wizard';
    170170                                $form_action = bp_core_update_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 ), 'admin.php' ) );
    171171                        ?>
    172172
     
    11041104                        bp_core_add_admin_menu();
    11051105
    11061106                        // Redirect to the BuddyPress dashboard
    1107                         $redirect = bp_core_update_do_network_admin() ? add_query_arg( array( 'page' => 'bp-general-settings' ), network_admin_url( 'admin.php' ) ) : add_query_arg( array( 'page' => 'bp-general-settings' ), admin_url( 'admin.php' ) );
     1107                        $redirect = bp_core_update_do_network_admin() ? add_query_arg( array( 'page' => 'bp-general-config' ), network_admin_url( 'admin.php' ) ) : add_query_arg( array( 'page' => 'bp-general-config' ), admin_url( 'admin.php' ) );
    11081108
    11091109                        wp_redirect( $redirect );
    11101110
     
    13251325                }
    13261326
    13271327                /* Settings Icon */
    1328                 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img { display: none; }
    1329                 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; }
    1330                 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a,
    1331                 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a {
     1328                ul#adminmenu li.toplevel_page_bp-general-config .wp-menu-image a img { display: none; }
     1329                ul#adminmenu li.toplevel_page_bp-general-config .wp-menu-image a { background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px; }
     1330                ul#adminmenu li.toplevel_page_bp-general-config:hover .wp-menu-image a,
     1331                ul#adminmenu li.toplevel_page_bp-general-config.wp-has-current-submenu .wp-menu-image a {
    13321332                        background-position: -1px 0;
    13331333                }
    13341334        </style>
  • bp-core/bp-core-cssjs.php

     
    2222                }
    2323
    2424                /* Settings Icon */
    25                 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img { display: none; }
    26                 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; }
     25                ul#adminmenu li.toplevel_page_bp-general-config .wp-menu-image a img,
     26                ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img {
     27                        display: none;
     28                }
     29
     30                ul#adminmenu li.toplevel_page_bp-general-config .wp-menu-image a,
     31                ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a {
     32                        background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px;
     33                }
     34
     35                ul#adminmenu li.toplevel_page_bp-general-config:hover .wp-menu-image a,
    2736                ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a,
     37                ul#adminmenu li.toplevel_page_bp-general-config.wp-has-current-submenu .wp-menu-image a,
    2838                ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a {
    2939                        background-position: -1px 0;
    3040                }
  • bp-forums/bp-forums-admin.php

     
    99                return false;
    1010
    1111        // Add the administration tab under the "Site Admin" tab for site administrators
    12         $hook = add_submenu_page( 'bp-general-settings', __( 'Forums', 'buddypress' ), __( 'Forums', 'buddypress' ), 'manage_options', 'bb-forums-setup', "bp_forums_bbpress_admin" );
     12        $hook = add_options_page( __( 'BP Forums', 'buddypress' ), __( 'BP Forums', 'buddypress' ), 'manage_options', 'bb-forums-setup', "bp_forums_bbpress_admin" );
    1313        add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' );
    1414}
    1515add_action( bp_core_admin_hook(), 'bp_forums_add_admin_menu' );