bp_core_admin_slugs_options()
Creates reusable markup for page setup on the Components and Pages dashboard panel.
Description Description
Source Source
File: bp-core/admin/bp-core-admin-slugs.php
function bp_core_admin_slugs_options() {
// Get the existing WP pages
$existing_pages = bp_core_get_directory_page_ids();
// Set up an array of components (along with component names) that have directory pages.
$directory_pages = bp_core_admin_get_directory_pages();
if ( !empty( $directory_pages ) ) : ?>
<h3><?php _e( 'Directories', 'buddypress' ); ?></h3>
<p><?php _e( 'Associate a WordPress Page with each BuddyPress component directory.', 'buddypress' ); ?></p>
<table class="form-table">
<tbody>
<?php foreach ( $directory_pages as $name => $label ) : ?>
<tr valign="top">
<th scope="row">
<label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label>
</th>
<td>
<?php if ( ! bp_is_root_blog() ) switch_to_blog( bp_get_root_blog_id() ); ?>
<?php echo wp_dropdown_pages( array(
'name' => 'bp_pages[' . esc_attr( $name ) . ']',
'echo' => false,
'show_option_none' => __( '- None -', 'buddypress' ),
'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
) ); ?>
<?php if ( !empty( $existing_pages[$name] ) ) : ?>
<a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View', 'buddypress' ); ?></a>
<?php endif; ?>
<?php if ( ! bp_is_root_blog() ) restore_current_blog(); ?>
</td>
</tr>
<?php endforeach ?>
<?php
/**
* Fires after the display of default directories.
*
* Allows plugins to add their own directory associations.
*
* @since 1.5.0
*/
do_action( 'bp_active_external_directories' ); ?>
</tbody>
</table>
<?php
endif;
/** Static Display ********************************************************/
$static_pages = bp_core_admin_get_static_pages();
if ( !empty( $static_pages ) ) : ?>
<h3><?php _e( 'Registration', 'buddypress' ); ?></h3>
<?php if ( bp_get_signup_allowed() ) : ?>
<p><?php _e( 'Associate WordPress Pages with the following BuddyPress Registration pages.', 'buddypress' ); ?></p>
<?php else : ?>
<?php if ( is_multisite() ) : ?>
<p><?php printf( __( 'Registration is currently disabled. Before associating a page is allowed, please enable registration by selecting either the "User accounts may be registered" or "Both sites and user accounts can be registered" option on <a href="%s">this page</a>.', 'buddypress' ), network_admin_url( 'settings.php' ) ); ?></p>
<?php else : ?>
<p><?php printf( __( 'Registration is currently disabled. Before associating a page is allowed, please enable registration by clicking on the "Anyone can register" checkbox on <a href="%s">this page</a>.', 'buddypress' ), admin_url( 'options-general.php' ) ); ?></p>
<?php endif; ?>
<?php endif; ?>
<table class="form-table">
<tbody>
<?php if ( bp_get_signup_allowed() ) : foreach ( $static_pages as $name => $label ) : ?>
<tr valign="top">
<th scope="row">
<label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label>
</th>
<td>
<?php if ( ! bp_is_root_blog() ) switch_to_blog( bp_get_root_blog_id() ); ?>
<?php echo wp_dropdown_pages( array(
'name' => 'bp_pages[' . esc_attr( $name ) . ']',
'echo' => false,
'show_option_none' => __( '- None -', 'buddypress' ),
'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
) ) ?>
<?php if ( !empty( $existing_pages[$name] ) ) : ?>
<a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View', 'buddypress' ); ?></a>
<?php endif; ?>
<?php if ( ! bp_is_root_blog() ) restore_current_blog(); ?>
</td>
</tr>
<?php endforeach; endif; ?>
<?php
/**
* Fires after the display of default static pages for BuddyPress setup.
*
* @since 1.5.0
*/
do_action( 'bp_active_external_pages' ); ?>
</tbody>
</table>
<?php
endif;
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.6.0 | Introduced. |