Skip to:
Content

BuddyPress.org

Changeset 3975


Ignore:
Timestamp:
01/31/2011 03:29:02 PM (15 years ago)
Author:
boonebgorges
Message:

Reworks Component Setup admin screen to better match WP admin. Adds Page Setup section to enable bp-pages configuration after installation. Fixes #3019

File:
1 edited

Legend:

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

    r3917 r3975  
    234234            return false;
    235235
    236         // Settings form submitted, now save the settings.
     236        // Settings form submitted, now save the settings. First, set active components
    237237        foreach ( (array)$_POST['bp_components'] as $key => $value ) {
    238238            if ( !(int) $value )
     
    240240        }
    241241        update_site_option( 'bp-deactivated-components', $disabled );
     242       
     243        // Then, update the directory pages
     244        $directory_pages = array();
     245        foreach ( (array)$_POST['bp_pages'] as $key => $value ) {
     246            if ( !empty( $value ) )
     247                $directory_pages[$key] = (int)$value;
     248        }
     249        bp_core_update_page_meta( $directory_pages );
    242250    } ?>
    243251
     
    256264        <form action="" method="post" id="bp-admin-component-form">
    257265
    258             <p><?php _e('By default, all BuddyPress components are enabled. You can selectively disable any of the components by using the form below. Your BuddyPress installation will continue to function, however the features of the disabled components will no longer be accessible to anyone using the site.', 'buddypress' ) ?></p>
     266           
    259267
    260268            <?php $disabled_components = get_site_option( 'bp-deactivated-components' ); ?>
    261269           
    262270            <?php bp_core_admin_component_options() ?>
     271           
     272            <?php bp_core_admin_page_options() ?>
    263273
    264274            <p class="submit clear">
     
    275285
    276286/**
    277  * Creates reusable markup for the component setup dashboard panel.
     287 * Creates reusable markup for component setup on the Components and Pages dashboard panel.
    278288 *
    279289 * This markup has been abstracted so that it can be used both during the setup wizard as well as
     
    285295function bp_core_admin_component_options() {
    286296    $disabled_components = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) );
     297   
     298    // An array of strings looped over to create component setup markup
     299    $optional_components = array(
     300        'xprofile' => array(
     301            'title'     => __( "Extended Profiles", 'buddypress' ),
     302            'description'   => __( "Fully editable profile fields allow you to define the fields users can fill in to describe themselves. Tailor profile fields to suit your audience.", 'buddypress' )
     303        ),
     304        'friends' => array(
     305            'title'     => __( "Friend Connections", 'buddypress' ),
     306            'description'   => __( "Let your users make connections so they can track the activity of others, or filter on only those users they care about the most.", 'buddypress' )
     307        ),
     308        'messages' => array(
     309            'title'     => __( "Private Messaging", 'buddypress' ),
     310            'description'   => __( "Private messaging will allow your users to talk to each other directly, and in private. Not just limited to one on one discussions, your users can send messages to multiple recipients.", 'buddypress' )
     311        ),
     312        'activity' => array(
     313            'title'     => __( "Activity Streams", 'buddypress' ),
     314            'description'   => __( "Global, personal and group activity streams with threaded commenting, direct posting, favoriting and @mentions. All with full RSS feed and email notification support.", 'buddypress' )
     315        ),
     316        'groups' => array(
     317            'title'     => __( "Extensible Groups", 'buddypress' ),
     318            'description'   => __( "Powerful public, private or hidden groups allow your users to break the discussion down into specific topics with a separate activity stream and member listing.", 'buddypress' )
     319        ),
     320        'forums' => array(
     321            'title'     => __( "Discussion Forums", 'buddypress' ),
     322            'description'   => __( "Full powered discussion forums built directly into groups allow for more conventional in-depth conversations. NOTE: This will require an extra (but easy) setup step.", 'buddypress' )
     323        )
     324    );
     325   
     326    if ( is_multisite() ) {
     327        $optional_components['blogs'] = array(
     328            'title'     => __( "Blog Tracking", 'buddypress' ),
     329            'description'   => __( "Track new blogs, new posts and new comments across your entire blog network.", 'buddypress' )
     330        );
     331    }
     332   
    287333    ?>
    288334   
    289     <div class="component">
    290         <h5><?php _e( "Extended Profiles", 'buddypress' ) ?></h5>
    291 
    292         <div class="radio">
    293             <input type="radio" name="bp_components[bp-xprofile.php]" value="1"<?php if ( !isset( $disabled_components['bp-xprofile.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
    294             <input type="radio" name="bp_components[bp-xprofile.php]" value="0"<?php if ( isset( $disabled_components['bp-xprofile.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
    295         </div>
    296 
    297         <img src="<?php echo plugins_url( 'buddypress/screenshot-2.gif' ) ?>" alt="Activity Streams" />
    298         <p><?php _e( "Fully editable profile fields allow you to define the fields users can fill in to describe themselves. Tailor profile fields to suit your audience.", 'buddypress' ) ?></p>
    299     </div>
    300 
    301     <div class="component">
    302         <h5><?php _e( "Friend Connections", 'buddypress' ) ?></h5>
    303 
    304         <div class="radio">
    305             <input type="radio" name="bp_components[bp-friends.php]" value="1"<?php if ( !isset( $disabled_components['bp-friends.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
    306             <input type="radio" name="bp_components[bp-friends.php]" value="0"<?php if ( isset( $disabled_components['bp-friends.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
    307         </div>
    308 
    309         <img src="<?php echo plugins_url( 'buddypress/screenshot-4.gif' ) ?>" alt="Activity Streams" />
    310         <p><?php _e( "Let your users make connections so they can track the activity of others, or filter on only those users they care about the most.", 'buddypress' ) ?></p>
    311     </div>
    312 
    313     <div class="component">
    314         <h5><?php _e( "Discussion Forums", 'buddypress' ) ?></h5>
    315 
    316         <div class="radio">
    317             <input type="radio" name="bp_components[bp-forums.php]" value="1"<?php if ( !isset( $disabled_components['bp-forums.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
    318             <input type="radio" name="bp_components[bp-forums.php]" value="0"<?php if ( isset( $disabled_components['bp-forums.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
    319         </div>
    320 
    321         <img src="<?php echo plugins_url( 'buddypress/screenshot-6.gif' ) ?>" alt="Activity Streams" />
    322         <p><?php _e( "Full powered discussion forums built directly into groups allow for more conventional in-depth conversations. <strong>NOTE: This will require an extra (but easy) setup step.</strong>", 'buddypress' ) ?></p>
    323     </div>
    324 
    325     <div class="component">
    326         <h5><?php _e( "Activity Streams", 'buddypress' ) ?></h5>
    327 
    328         <div class="radio">
    329             <input type="radio" name="bp_components[bp-activity.php]" value="1"<?php if ( !isset( $disabled_components['bp-activity.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
    330             <input type="radio" name="bp_components[bp-activity.php]" value="0"<?php if ( isset( $disabled_components['bp-activity.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
    331         </div>
    332 
    333         <img src="<?php echo plugins_url( 'buddypress/screenshot-1.gif' ) ?>" alt="Activity Streams" />
    334         <p><?php _e( "Global, personal and group activity streams with threaded commenting, direct posting, favoriting and @mentions. All with full RSS feed and email notification support.", 'buddypress' ) ?></p>
    335     </div>
    336 
    337     <div class="component">
    338         <h5><?php _e( "Extensible Groups", 'buddypress' ) ?></h5>
    339 
    340         <div class="radio">
    341             <input type="radio" name="bp_components[bp-groups.php]" value="1"<?php if ( !isset( $disabled_components['bp-groups.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
    342             <input type="radio" name="bp_components[bp-groups.php]" value="0"<?php if ( isset( $disabled_components['bp-groups.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
    343         </div>
    344 
    345         <img src="<?php echo plugins_url( 'buddypress/screenshot-3.gif' ) ?>" alt="Activity Streams" />
    346         <p><?php _e( "Powerful public, private or hidden groups allow your users to break the discussion down into specific topics with a separate activity stream and member listing.", 'buddypress' ) ?></p>
    347     </div>
    348 
    349     <div class="component">
    350         <h5><?php _e( "Private Messaging", 'buddypress' ) ?></h5>
    351 
    352         <div class="radio">
    353             <input type="radio" name="bp_components[bp-messages.php]" value="1"<?php if ( !isset( $disabled_components['bp-messages.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
    354             <input type="radio" name="bp_components[bp-messages.php]" value="0"<?php if ( isset( $disabled_components['bp-messages.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
    355         </div>
    356 
    357         <img src="<?php echo plugins_url( 'buddypress/screenshot-5.gif' ) ?>" alt="Activity Streams" />
    358         <p><?php _e( "Private messaging will allow your users to talk to each other directly, and in private. Not just limited to one on one discussions, your users can send messages to multiple recipients.", 'buddypress' ) ?></p>
    359     </div>
    360 
    361     <?php if ( is_multisite() ) : ?>
    362 
    363         <div class="component">
    364             <h5><?php _e( "Blog Tracking", 'buddypress' ) ?></h5>
    365 
    366             <div class="radio">
    367                 <input type="radio" name="bp_components[bp-blogs.php]" value="1"<?php if ( !isset( $disabled_components['bp-blogs.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
    368                 <input type="radio" name="bp_components[bp-blogs.php]" value="0"<?php if ( isset( $disabled_components['bp-blogs.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
    369             </div>
    370 
    371             <img src="<?php echo plugins_url( 'buddypress/screenshot-7.gif' ) ?>" alt="Activity Streams" />
    372                 <p><?php _e( "Track new blogs, new posts and new comments across your entire blog network.", 'buddypress' ) ?></p>
    373         </div>
    374 
    375     <?php else: ?>
    376 
     335    <h3><?php _e( 'Optional Components', 'buddypress' ) ?></h3>
     336               
     337    <p><?php _e( "Select the BuddyPress components you'd like to enable.", 'buddypress' ) ?></p>
     338   
     339    <table class="form-table">
     340        <tbody>
     341            <?php foreach ( $optional_components as $name => $labels ) : ?>
     342            <tr valign="top">
     343                <th scope="row">
     344                    <?php echo esc_html( $labels['title'] ) ?>
     345                </th>
     346               
     347                <td>
     348                    <label for="bp_components[bp-<?php echo esc_attr( $name ) ?>.php]">
     349                        <input type="checkbox" name="bp_components[bp-<?php echo esc_attr( $name ) ?>.php]" value="1"<?php if ( !isset( $disabled_components['bp-' . esc_attr( $name ) . '.php'] ) ) : ?> checked="checked"<?php endif ?> />
     350                        <?php echo esc_html( $labels['description'] ) ?>
     351                    </label>
     352
     353                </td>
     354            </tr>
     355            <?php endforeach ?>
     356        </tbody>
     357    </table>
     358
     359    <?php /* Make sure that the blogs component is deactivated when multisite is shut off */ ?>
     360    <?php if ( !is_multisite() ) : ?>
    377361        <input type="hidden" name="bp_components[bp-blogs.php]" value="0" />
    378 
    379     <?php endif; ?>
     362    <?php endif ?>
     363   
     364    <?php
     365}
     366
     367/**
     368 * Creates reusable markup for page setup on the Components and Pages dashboard panel.
     369 *
     370 * This markup has been abstracted so that it can be used both during the setup wizard as well as
     371 * when BP has been fully installed.
     372 *
     373 * @package BuddyPress Core
     374 * @since 1.3
     375 */
     376function bp_core_admin_page_options() {
     377    // Get the existing WP pages
     378    $existing_pages = bp_core_get_page_meta();
     379   
     380    // An array of strings looped over to create component setup markup
     381    $directory_pages = array(
     382        'groups' => __( "Groups Directory", 'buddypress' ),
     383        'forums' => __( "Forums Directory", 'buddypress' ),
     384        'members' => __( "Members Directory", 'buddypress' ),
     385        'activity' => __( "Activity", 'buddypress' ),
     386        'register' => __( "Register", 'buddypress' ),
     387        'activate' => __( "Activate", 'buddypress' )
     388    );
     389   
     390    if ( is_multisite() ) {
     391        $directory_pages['blogs'] = __( "Blogs Directory", 'buddypress' );
     392    }
     393   
     394    ?>
     395   
     396    <h3><?php _e( "BuddyPress Page Setup", 'buddypress' ) ?></h3>
     397   
     398    <p><?php _e( "Choose the WordPress pages you'd like to associate with the following BuddyPress content.", 'buddypress' ) ?></p>
     399   
     400    <p><?php _e( "Leaving any of these items unset makes that content inaccessible to visitors, so be sure to fill this section out carefully.", 'buddypress' ) ?></p>
     401   
     402    <table class="form-table">
     403        <tbody>
     404            <?php foreach ( $directory_pages as $name => $label ) : ?>
     405            <tr valign="top">
     406                <th scope="row">
     407                    <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label>
     408                </th>
     409               
     410                <td>
     411                    <?php echo wp_dropdown_pages( array(
     412                        'name' => 'bp_pages[' . esc_attr( $name ) . ']',
     413                        'echo' => false,
     414                        'show_option_none' => __( '- Select -', 'buddypress' ),
     415                        'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
     416                    ) ) ?>
     417                </td>
     418            </tr>
     419            <?php endforeach ?>
     420        </tbody>
     421    </table>
    380422   
    381423    <?php
Note: See TracChangeset for help on using the changeset viewer.