Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/04/2009 07:08:16 PM (15 years ago)
Author:
apeatling
Message:

Added bp-loader.php to the repo, that will selectively load components based on what the user has enabled/disabled via the "BuddyPress > Component Setup" admin panel.

BuddyPress is now just one plugin to activate, once activated you can disable components via the menu mentioned above. This has been done to provide better support for the auto-update functionality, and to try to reduce the "plugin suite" confusion. Each component is still a separate plugin, but they are just not activated individually.

Also added a "BuddyPress" top level navigation item to the admin panel. BuddyPress settings are all now contained under this menu. "Groups" still sits in site admin though, as it fits in well with the "Users" and "Blogs" menus.

File:
1 edited

Legend:

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

    r1303 r1311  
    3131       
    3232        <h2><?php _e( 'BuddyPress Settings', 'buddypress' ) ?></h2>
    33    
     33
     34        <?php if ( isset( $_POST['bp-admin'] ) ) : ?>
     35            <div id="message" class="updated fade">
     36                <p><?php _e( 'Settings Saved', 'buddypress' ) ?></p>
     37            </div>
     38        <?php endif; ?>
     39
    3440        <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" id="bp-admin-form">
    3541       
     
    104110   
    105111            <p class="submit">
    106                 <input type="submit" name="bp-admin-submit" id="bp-admin-submit" value="<?php _e( 'Save Settings', 'buddypress' ) ?>"/>
     112                <input class="button-primary" type="submit" name="bp-admin-submit" id="bp-admin-submit" value="<?php _e( 'Save Settings', 'buddypress' ) ?>"/>
    107113            </p>
    108114
    109115            <?php do_action( 'bp_core_admin_screen' ) ?>
    110            
    111             <h4><?php _e( 'BuddyPress Version Numbers', 'buddypress' ) ?></h4>
    112            
    113             <?php bp_core_print_version_numbers() ?>
    114        
    115             <?php wp_nonce_field( 'bp-admin') ?>
     116
     117            <?php wp_nonce_field( 'bp-admin' ) ?>
    116118       
    117119        </form>
     
    122124}
    123125
     126function bp_core_admin_component_setup() {
     127    global $wpdb, $bp;
    124128?>
     129   
     130    <?php
     131    if ( isset( $_POST['bp-admin-component-submit'] ) && isset( $_POST['bp_components'] ) ) {
     132        if ( !check_admin_referer('bp-admin-component-setup') )
     133            return false;
     134       
     135        // Settings form submitted, now save the settings.
     136        foreach ( $_POST['bp_components'] as $key => $value ) {
     137            if ( !(int) $value )
     138                $disabled[$key] = 1;   
     139        }
     140        update_site_option( 'bp-deactivated-components', $disabled );
     141    }
     142    ?>
     143   
     144    <div class="wrap">
     145       
     146        <h2><?php _e( 'BuddyPress Component Setup', 'buddypress' ) ?></h2>
     147       
     148        <?php if ( isset( $_POST['bp-admin-component-submit'] ) ) : ?>
     149            <div id="message" class="updated fade">
     150                <p><?php _e( 'Settings Saved', 'buddypress' ) ?></p>
     151            </div>
     152        <?php endif; ?>
     153   
     154        <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" id="bp-admin-component-form">
     155       
     156            <p>
     157            <?php _e(
     158                'By default, all BuddyPress components are enabled. You can selectively disable any of the
     159                components by using the form below. Your BuddyPress installation will continue to function
     160                however the features associated with the disabled components will no longer be accessible to
     161                your anyone using the site.
     162                ')?>
     163            </p>
     164           
     165            <?php $disabled_components = get_site_option( 'bp-deactivated-components' ); ?>
     166           
     167            <table class="form-table" style="width: 80%">
     168            <tbody>
     169                <?php if ( file_exists( BP_PLUGIN_DIR . '/bp-activity.php') ) : ?>
     170                <tr>
     171                    <td><h3><?php _e( 'Activity Streams', 'buddypress' ) ?></h3><p><?php _e( 'Tracks user activity across the entire site.', 'buddypress' ) ?></p></td>
     172                    <td>
     173                        <input type="radio" name="bp_components[bp-activity.php]" value="1"<?php if ( !isset( $disabled_components['bp-activity.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Enabled &nbsp;
     174                        <input type="radio" name="bp_components[bp-activity.php]" value="0"<?php if ( isset( $disabled_components['bp-activity.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Disabled
     175                    </td>           
     176                </tr>
     177                <?php endif; ?>
     178                <?php if ( file_exists( BP_PLUGIN_DIR . '/bp-blogs.php') ) : ?>
     179                <tr>
     180                    <td><h3><?php _e( 'Blog Tracking', 'buddypress' ) ?></h3><p><?php _e( 'Tracks blogs, blog posts and blogs comments for a user across a WPMU installation.', 'buddypress' ) ?></p></td>
     181                    <td>
     182                        <input type="radio" name="bp_components[bp-blogs.php]" value="1"<?php if ( !isset( $disabled_components['bp-blogs.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Enabled &nbsp;
     183                        <input type="radio" name="bp_components[bp-blogs.php]" value="0"<?php if ( isset( $disabled_components['bp-blogs.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Disabled
     184                    </td>           
     185                </tr>
     186                <?php endif; ?>
     187                <?php if ( file_exists( BP_PLUGIN_DIR . '/bp-forums.php') ) : ?>
     188                <tr>
     189                    <td><h3><?php _e( 'bbPress Forums', 'buddypress' ) ?></h3><p><?php _e( 'Activates bbPress forum support within BuddyPress groups or any other custom component.', 'buddypress' ) ?></p></td>
     190                    <td>
     191                        <input type="radio" name="bp_components[bp-forums.php]" value="1"<?php if ( !isset( $disabled_components['bp-forums.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Enabled &nbsp;
     192                        <input type="radio" name="bp_components[bp-forums.php]" value="0"<?php if ( isset( $disabled_components['bp-forums.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Disabled
     193                    </td>           
     194                </tr>
     195                <?php endif; ?>
     196                <?php if ( file_exists( BP_PLUGIN_DIR . '/bp-friends.php') ) : ?>
     197                <tr>
     198                    <td><h3><?php _e( 'Friends', 'buddypress' ) ?></h3><p><?php _e( 'Allows the creation of friend connections between users.', 'buddypress' ) ?></p></td>
     199                    <td>
     200                        <input type="radio" name="bp_components[bp-friends.php]" value="1"<?php if ( !isset( $disabled_components['bp-friends.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Enabled &nbsp;
     201                        <input type="radio" name="bp_components[bp-friends.php]" value="0"<?php if ( isset( $disabled_components['bp-friends.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Disabled
     202                    </td>           
     203                </tr>
     204                <?php endif; ?>
     205                <?php if ( file_exists( BP_PLUGIN_DIR . '/bp-groups.php') ) : ?>
     206                <tr>
     207                    <td><h3><?php _e( 'Groups', 'buddypress' ) ?></h3><p><?php _e( 'Let users create, join and participate in groups.', 'buddypress' ) ?></p></td>
     208                    <td>
     209                        <input type="radio" name="bp_components[bp-groups.php]" value="1"<?php if ( !isset( $disabled_components['bp-groups.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Enabled &nbsp;
     210                        <input type="radio" name="bp_components[bp-groups.php]" value="0"<?php if ( isset( $disabled_components['bp-groups.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Disabled
     211                    </td>           
     212                </tr>
     213                <?php endif; ?>
     214                <?php if ( file_exists( BP_PLUGIN_DIR . '/bp-messages.php') ) : ?>
     215                <tr>
     216                    <td><h3><?php _e( 'Private Messaging', 'buddypress' ) ?></h3><p><?php _e( 'Let users send private messages to one another. Site admins can also send site-wide notices.', 'buddypress' ) ?></p></td>
     217                    <td>
     218                        <input type="radio" name="bp_components[bp-messages.php]" value="1"<?php if ( !isset( $disabled_components['bp-messages.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Enabled &nbsp;
     219                        <input type="radio" name="bp_components[bp-messages.php]" value="0"<?php if ( isset( $disabled_components['bp-messages.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Disabled
     220                    </td>           
     221                </tr>
     222                <?php endif; ?>
     223                <?php if ( file_exists( BP_PLUGIN_DIR . '/bp-wire.php') ) : ?>
     224                <tr>
     225                    <td><h3><?php _e( 'Comment Wire', 'buddypress' ) ?></h3><p><?php _e( 'Let users leave a comment on groups, profiles and custom components.', 'buddypress' ) ?></p></td>
     226                    <td>
     227                        <input type="radio" name="bp_components[bp-wire.php]" value="1"<?php if ( !isset( $disabled_components['bp-wire.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Enabled &nbsp;
     228                        <input type="radio" name="bp_components[bp-wire.php]" value="0"<?php if ( isset( $disabled_components['bp-wire.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Disabled
     229                    </td>           
     230                </tr>
     231                <?php endif; ?>
     232                <?php if ( file_exists( BP_PLUGIN_DIR . '/bp-xprofile.php') ) : ?>
     233                <tr>
     234                    <td><h3><?php _e( 'Extended Profiles', 'buddypress' ) ?></h3><p><?php _e( 'Activates customizable profiles and avatars for site users.', 'buddypress' ) ?></p></td>
     235                    <td width="45%">
     236                        <input type="radio" name="bp_components[bp-xprofile.php]" value="1"<?php if ( !isset( $disabled_components['bp-xprofile.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Enabled &nbsp;
     237                        <input type="radio" name="bp_components[bp-xprofile.php]" value="0"<?php if ( isset( $disabled_components['bp-xprofile.php'] ) ) : ?> checked="checked" <?php endif; ?>/> Disabled
     238                    </td>           
     239                </tr>
     240                <?php endif; ?>
     241            </tbody>
     242            </table>
     243           
     244            <p class="submit">
     245                <input class="button-primary" type="submit" name="bp-admin-component-submit" id="bp-admin-component-submit" value="<?php _e( 'Save Settings', 'buddypress' ) ?>"/>
     246            </p>
     247           
     248            <?php wp_nonce_field( 'bp-admin-component-setup' ) ?>
     249       
     250        </form>
     251       
     252        <p>&nbsp;</p>
     253       
     254    </div>
     255   
     256<?php
     257}
     258
     259?>
Note: See TracChangeset for help on using the changeset viewer.