Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/03/2011 09:03:41 PM (15 years ago)
Author:
johnjamesjacoby
Message:

Add bp-pages admin interface for all components. Rename bp-pages related functions to match existing nomenclature. Introduce 'has_directory' variable in BP_Component class to assist in pairing page slugs to component directories. Set 'path' variable in components that were missing them. Clean up white space where tabs were used instead of spaces. See #3428. Props boonebgorges.

File:
1 edited

Legend:

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

    r4907 r4920  
    212212                                }
    213213                        }
    214                         bp_core_update_page_meta( $directory_pages );
     214                        bp_core_update_directory_page_ids( $directory_pages );
    215215                }
    216216
    … …  
    353353                ),
    354354                'messages' => array(
    355                         'title'       => __( 'Private Messaging', 'buddypress' ),
     355                        'title'       => __( 'Private Messaging', 'buddypress' ),
    356356                        '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' )
    357357                ),
    … …  
    372372        if ( is_multisite() ) {
    373373                $optional_components['blogs'] = array(
    374                         'title'       => __( 'Site Tracking', 'buddypress' ),
     374                        'title'       => __( 'Site Tracking', 'buddypress' ),
    375375                        'description' => __( 'Track new sites, new posts and new comments across your entire network.', 'buddypress' )
    376376                );
    … …  
    482482       
    483483        // Get the existing WP pages
    484         $existing_pages = bp_core_get_page_meta();
    485 
    486         // An array of strings looped over to create component setup markup
    487         $directory_pages = array(
    488                 'members'  => __( 'Community Members', 'buddypress' ),
    489                 'activity' => __( 'Activity Streams',  'buddypress' ),
    490                 'groups'   => __( 'User Groups',       'buddypress' ),
    491                 'forums'   => __( 'Discussion Forums', 'buddypress' ),
    492         );
    493 
    494         if ( is_multisite() )
    495                 $directory_pages['blogs'] = __( "Site Directory", 'buddypress' ); ?>
     484        $existing_pages = bp_core_get_directory_page_ids();
     485
     486        // Set up an array of components (along with component names) that have
     487        // directory pages.
     488        $directory_pages = array();
     489
     490        foreach( $bp->loaded_components as $component_id => $data ) {
     491
     492                // Only components that need directories should be listed here
     493                if ( isset( $bp->{$component_id} ) && !empty( $bp->{$component_id}->has_directory ) ) {
     494                       
     495                        // component->name was introduced in BP 1.5, so we must provide a fallback
     496                        $component_name = !empty( $bp->{$component_id}->name ) ? $bp->{$component_id}->name : ucwords( $component_id );
     497                       
     498                        $directory_pages[$component_id] = $component_name;
     499                }
     500        }
     501       
     502        $directory_pages = apply_filters( 'bp_directory_pages', $directory_pages );
     503       
     504        ?>
    496505       
    497506        <h3><?php _e( 'Directories', 'buddypress' ); ?></h3>
    498507       
    499         <p><?php _e( 'Choose a WordPress Page to associate with each available BuddyPress Component directory.', 'buddypress' ); ?></p>
     508        <p><?php _e( 'Associate a WordPress Page with each BuddyPress component directory.', 'buddypress' ); ?></p>
    500509
    501510        <table class="form-table">
Note: See TracChangeset for help on using the changeset viewer.