Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/24/2012 08:23:48 PM (12 years ago)
Author:
boonebgorges
Message:

Modify the text and URL of the Site Wide Forums setup button on Dashboard > Forums Setup

If bbPress is already running, it doesn't make sense to show an Install Site
Wide Forums button. Instead, the button should point to the bbPress config
page.

See #4292

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums/bp-forums-admin.php

    r6108 r6134  
    1919add_action( bp_core_admin_hook(), 'bp_forums_add_admin_menu' );
    2020
     21/**
     22 * Outputs the markup for the bb-forums-admin panel
     23 */
    2124function bp_forums_bbpress_admin() {
    2225    global $bp;
     26
     27    // The text and URL of the Site Wide Forums button differs depending on whether bbPress
     28    // is running
     29    if ( is_plugin_active( 'bbpress/bbpress.php' ) ) {
     30        // The bbPress admin page will always be on the root blog. switch_to_blog() will
     31        // pass through if we're already there.
     32        switch_to_blog( bp_get_root_blog_id() );
     33        $button_url = admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) );
     34        restore_current_blog();
     35
     36        $button_text = __( 'Configure Site Wide Forums', 'buddypress' );
     37    } else {
     38        $button_url = bp_get_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) );
     39        $button_text = __( 'Install Site Wide Forums', 'buddypress' );
     40    }
    2341
    2442    $action = bp_get_admin_url( 'admin.php?page=bb-forums-setup&reinstall=1' ); ?>
     
    7896                    <li><?php _e( '@ Mention Integration',       'buddypress' ); ?></p></li>
    7997                </ul>
     98
    8099                <div>
    81                     <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> &nbsp;
     100                    <a class="button thickbox button-primary" href="<?php echo esc_attr( $button_url ) ?>"><?php echo esc_html( $button_text ) ?></a> &nbsp;
    82101                </div>
    83102            </div>
Note: See TracChangeset for help on using the changeset viewer.