Skip to:
Content

BuddyPress.org

Ticket #4603: settings-link-fix-2.patch

File settings-link-fix-2.patch, 1.4 KB (added by apeatling, 14 years ago)

Less duplication and better structure.

  • bp-core/bp-core-admin.php

     
    360360         * @return array Processed links
    361361         */
    362362        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' );
    363367
    364                 if ( buddypress()->basename == $file ) {
    365                         $url           = bp_core_do_network_admin() ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );
    366                         $settings_link = '<a href="' . add_query_arg( array( 'page' => 'bp-components' ), $url ) . '">' . __( 'Settings', 'buddypress' ) . '</a>';
     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 = __( '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
    367378                        array_unshift( $links, $settings_link );
    368379                }
    369380