Skip to:
Content

BuddyPress.org

Changeset 3989


Ignore:
Timestamp:
02/02/2011 01:26:28 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Switch setting from bp-deactivated-components to bp-active-components. Adjust some verbiage on the component settings page. Use smarter logic to show/hide possible directory page assignments based on active components.

Location:
trunk
Files:
5 edited

Legend:

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

    r3987 r3989  
    228228
    229229        // Settings form submitted, now save the settings. First, set active components
    230         foreach ( (array)$_POST['bp_components'] as $key => $value ) {
    231             if ( !(int) $value )
    232                 $disabled[$key] = 1;
     230        if ( isset( $_POST['bp_components'] ) ) {
     231            $bp->active_components = stripslashes_deep( $_POST['bp_components'] );
     232            update_site_option( 'bp-active-components', $bp->active_components );
    233233        }
    234         update_site_option( 'bp-deactivated-components', $disabled );
    235        
     234
    236235        // Then, update the directory pages
    237         $directory_pages = array();
    238         foreach ( (array)$_POST['bp_pages'] as $key => $value ) {
    239             if ( !empty( $value ) )
    240                 $directory_pages[$key] = (int)$value;
     236        if ( isset( $_POST['bp_pages'] ) ) {
     237            $directory_pages = array();
     238            foreach ( (array)$_POST['bp_pages'] as $key => $value ) {
     239                if ( !empty( $value ) ) {
     240                    $directory_pages[$key] = (int)$value;
     241                }
     242            }
     243            bp_core_update_page_meta( $directory_pages );
    241244        }
    242         bp_core_update_page_meta( $directory_pages );
    243245    } ?>
    244246
     
    263265            <?php
    264266
    265                 $disabled_components = get_site_option( 'bp-deactivated-components' );
    266267                bp_core_admin_component_options();
    267268                bp_core_admin_page_options();
     
    292293function bp_core_admin_component_options() {
    293294    global $bp_wizard;
    294    
    295     $disabled_components = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) );
     295
     296    $active_components = apply_filters( 'bp_active_components', get_site_option( 'bp-active-components' ) );
    296297   
    297298    // An array of strings looped over to create component setup markup
     
    299300        'xprofile' => array(
    300301            'title'       => __( 'Extended Profiles', 'buddypress' ),
    301             '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' )
     302            'description' => __( 'Customize your community with fully editable profile fields that allow your users use to uniquely describe themselves.', 'buddypress' )
     303        ),
     304        'settings' => array(
     305            'title'       => __( 'Account Settings', 'buddypress' ),
     306            'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress' )
    302307        ),
    303308        'friends' => array(
    304309            'title'       => __( 'Friend Connections', 'buddypress' ),
    305             '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' )
     310            'description' => __( 'Let your users make connections so they can track the activity of others and focus on the people they care about the most.', 'buddypress' )
    306311        ),
    307312        'messages' => array(
    308313            'title'       => __( 'Private Messaging', 'buddypress' ),
    309             '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' )
     314            'description' => __( 'Allow your users to talk to each other directly and in private. They are not just limited to one-on-one discussions, and can send messages to multiple recipients.', 'buddypress' )
    310315        ),
    311316        'activity' => array(
    312317            'title'       => __( 'Activity Streams', 'buddypress' ),
    313             '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' )
     318            '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' )
    314319        ),
    315320        'groups' => array(
    316             'title'       => __( 'Extensible Groups', 'buddypress' ),
    317             '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' )
     321            'title'       => __( 'User Groups', 'buddypress' ),
     322            'description' => __( 'Groups allow your users to organize themselves into specific public, private or hidden sections with a separate activity stream and member listing.', 'buddypress' )
    318323        ),
    319324        'forums' => array(
     
    350355
    351356                    <td>
    352                         <label for="bp_components[bp-<?php echo esc_attr( $name ); ?>.php]">
    353                             <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 ?> />
     357                        <label for="bp_components[<?php echo esc_attr( $name ); ?>]">
     358                            <input type="checkbox" name="bp_components[<?php echo esc_attr( $name ); ?>]" value="1"<?php checked( isset( $active_components[esc_attr( $name )] ) ); ?> />
    354359
    355360                            <?php echo esc_html( $labels['description'] ); ?>
     
    362367            <?php endforeach ?>
    363368
     369            <?php do_action( 'bp_active_external_components' ); ?>
     370
    364371        </tbody>
    365372    </table>
    366373
    367     <?php /* Make sure that the blogs component is deactivated when multisite is shut off */ ?>
    368     <?php if ( !is_multisite() ) : ?>
    369 
    370         <input type="hidden" name="bp_components[bp-blogs.php]" value="0" />
    371 
    372     <?php endif ?>
    373    
     374    <input type="hidden" name="bp_components[members]" value="1" />
     375
    374376    <?php
    375377}
     
    387389    // Get the existing WP pages
    388390    $existing_pages = bp_core_get_page_meta();
    389    
     391
    390392    // An array of strings looped over to create component setup markup
    391393    $directory_pages = array(
    392         'groups'   => __( 'Groups Directory', 'buddypress' ),
    393         'forums'   => __( 'Forums Directory', 'buddypress' ),
    394         'members'  => __( 'Members Directory', 'buddypress' ),
    395         'activity' => __( 'Activity', 'buddypress' ),
    396         'register' => __( 'Register', 'buddypress' ),
    397         'activate' => __( 'Activate', 'buddypress' )
     394        'members'  => __( 'Members Directory',  'buddypress' ),
     395        'activity' => __( 'Activity Directory', 'buddypress' ),
     396        'groups'   => __( 'Groups Directory',   'buddypress' ),
     397        'forums'   => __( 'Forums Directory',   'buddypress' ),
    398398    );
    399399   
     
    401401        $directory_pages['blogs'] = __( "Blogs Directory", 'buddypress' ); ?>
    402402   
    403     <h3><?php _e( 'Page Setup', 'buddypress' ); ?></h3>
    404    
    405     <p><?php _e( 'Choose the WordPress pages you would like to associate with the following BuddyPress content.', 'buddypress' ); ?></p>
    406    
    407     <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>
    408    
     403    <h3><?php _e( 'Directory Pages', 'buddypress' ); ?></h3>
     404   
     405    <p><?php _e( 'Choose a WordPress Page to associate with each BuddyPress component directory. Setting to "None" will render that page inaccessible.', 'buddypress' ); ?></p>
     406
    409407    <table class="form-table">
    410408        <tbody>
    411409
    412410            <?php foreach ( $directory_pages as $name => $label ) : ?>
     411
     412                <?php if ( bp_is_active( $name ) ) : ?>
     413
     414                    <tr valign="top">
     415                        <th scope="row">
     416                            <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label>
     417                        </th>
     418
     419                        <td>
     420                            <?php echo wp_dropdown_pages( array(
     421                                'name'             => 'bp_pages[' . esc_attr( $name ) . ']',
     422                                'echo'             => false,
     423                                'show_option_none' => __( '- None -', 'buddypress' ),
     424                                'selected'         => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
     425                            ) ) ?>
     426                        </td>
     427                    </tr>
     428
     429                <?php endif; ?>
     430
     431            <?php endforeach ?>
     432
     433            <?php do_action( 'bp_active_external_directories' ); ?>
     434
     435        </tbody>
     436    </table>
     437   
     438    <?php
     439
     440    // Static pages
     441    $static_pages = array(
     442        'register' => __( 'Sign up Page',    'buddypress' ),
     443        'activate' => __( 'Activation Page', 'buddypress' ),
     444    ); ?>
     445
     446    <h3><?php _e( 'Other Pages', 'buddypress' ); ?></h3>
     447
     448    <p><?php _e( 'Associate WordPress Pages with the following BuddyPress pages. Setting to "None" will render that page inaccessible.', 'buddypress' ); ?></p>
     449
     450    <table class="form-table">
     451        <tbody>
     452
     453            <?php foreach ( $static_pages as $name => $label ) : ?>
    413454
    414455                <tr valign="top">
     
    429470            <?php endforeach ?>
    430471
     472            <?php do_action( 'bp_active_external_pages' ); ?>
     473
    431474        </tbody>
    432475    </table>
    433    
     476
    434477    <?php
    435478}
  • trunk/bp-core/bp-core-bootstrap.php

    r3944 r3989  
    2929
    3030    // Get a list of deactivated components
    31     $bp_deactivated = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) );
     31    $bp->active_components = apply_filters( 'bp_active_components', get_site_option( 'bp-active-components' ) );
    3232
    3333    // Activity Streams
    34     if ( !isset( $bp_deactivated['bp-activity/bp-activity-loader.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-activity/bp-activity-loader.php') )
     34    if ( bp_is_active( 'activity') && file_exists( BP_PLUGIN_DIR . '/bp-activity/bp-activity-loader.php') )
    3535        include( BP_PLUGIN_DIR . '/bp-activity/bp-activity-loader.php' );
    3636
    3737    // Blog Tracking
    38     if ( !isset( $bp_deactivated['bp-blogs/bp-blogs-loader.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-loader.php') )
     38    if ( bp_is_active( 'blogs') && file_exists( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-loader.php') )
    3939        include( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-loader.php' );
    4040
    4141    // bbPress Forum Integration
    42     if ( !isset( $bp_deactivated['bp-forums/bp-forums-loader.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-forums/bp-forums-loader.php') )
     42    if ( bp_is_active( 'forums') && file_exists( BP_PLUGIN_DIR . '/bp-forums/bp-forums-loader.php') )
    4343        include( BP_PLUGIN_DIR . '/bp-forums/bp-forums-loader.php' );
    4444
    4545    // Friend Connections
    46     if ( !isset( $bp_deactivated['bp-friends/bp-friends-loader.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-friends/bp-friends-loader.php') )
     46    if ( bp_is_active( 'friends') && file_exists( BP_PLUGIN_DIR . '/bp-friends/bp-friends-loader.php') )
    4747        include( BP_PLUGIN_DIR . '/bp-friends/bp-friends-loader.php' );
    4848
    4949    // Groups Support
    50     if ( !isset( $bp_deactivated['bp-groups/bp-groups-loader.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-groups/bp-groups-loader.php') )
     50    if ( bp_is_active( 'groups') && file_exists( BP_PLUGIN_DIR . '/bp-groups/bp-groups-loader.php') )
    5151        include( BP_PLUGIN_DIR . '/bp-groups/bp-groups-loader.php' );
    5252
    5353    // Private Messaging
    54     if ( !isset( $bp_deactivated['bp-messages/bp-messages-loader.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-messages/bp-messages-loader.php') )
     54    if ( bp_is_active( 'messages') && file_exists( BP_PLUGIN_DIR . '/bp-messages/bp-messages-loader.php') )
    5555        include( BP_PLUGIN_DIR . '/bp-messages/bp-messages-loader.php' );
    5656
    5757    // Extended Profiles
    58     if ( !isset( $bp_deactivated['bp-xprofile/bp-xprofile-loader.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-loader.php') )
     58    if ( bp_is_active( 'xprofile') && file_exists( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-loader.php') )
    5959        include( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-loader.php' );
    6060
    6161    // Member Settings
    62     if ( !isset( $bp_deactivated['bp-settings/bp-settings-loader.php'] ) && file_exists( BP_PLUGIN_DIR . '/bp-settings/bp-settings-loader.php') )
     62    if ( bp_is_active( 'settings') && file_exists( BP_PLUGIN_DIR . '/bp-settings/bp-settings-loader.php') )
    6363        include( BP_PLUGIN_DIR . '/bp-settings/bp-settings-loader.php' );
    6464
  • trunk/bp-core/bp-core-template.php

    r3983 r3989  
    858858
    859859function bp_is_active( $component ) {
    860     global $bp_deactivated;
    861 
    862     if ( !isset( $bp_deactivated[ 'bp-' . $component . '/bp-' . $component . '-loader.php' ] ) )
     860    global $bp;
     861
     862    if ( isset( $bp->active_components[$component] ) )
    863863        return true;
    864864
  • trunk/bp-xprofile/admin/css/admin.dev.css

    r3987 r3989  
    122122    }
    123123    .field-group div.actions {
    124         display: none;
    125124        position: absolute;
    126125        right: 20px;
  • trunk/bp-xprofile/bp-xprofile-admin.php

    r3987 r3989  
    7373                foreach ( $groups as $group ) { ?>
    7474
    75                     <li id="group_<?php echo $group->id; ?>"><a href="#tabs-<?php echo $group->id; ?>" class="ui-tab"><?php echo esc_attr( $group->name ); ?><?php if ( !$group->can_delete ) : ?> <?php _e( '(Core)', 'buddypress'); endif; ?></a></li>
     75                    <li id="group_<?php echo $group->id; ?>"><a href="#tabs-<?php echo $group->id; ?>" class="ui-tab"><?php echo esc_attr( $group->name ); ?><?php if ( !$group->can_delete ) : ?> <?php _e( '(Primary)', 'buddypress'); endif; ?></a></li>
    7676
    7777<?php           }
     
    361361
    362362                        <fieldset id="field_<?php echo esc_attr( $field->id ); ?>" class="sortable<?php echo ' ' . $field->type; if ( $class ) echo ' ' . $class; ?>">
    363                             <legend><?php bp_the_profile_field_name(); ?> <?php if( !$field->can_delete ) : ?> <?php _e( '(Core)', 'buddypress' ); endif; ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></legend>
     363                            <legend><?php bp_the_profile_field_name(); ?> <?php if( !$field->can_delete ) : ?> <?php _e( '(Primary)', 'buddypress' ); endif; ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(Required)', 'buddypress' ) ?><?php endif; ?></legend>
    364364                            <div class="field-wrapper">
    365365
Note: See TracChangeset for help on using the changeset viewer.