bp_core_admin_slugs_options

Creates reusable markup for page setup on the Components and Pages dashboard panel.

Description

bp_core_admin_slugs_options(); 

Usage

  1. if ( !function_exists( 'bp_core_admin_slugs_options' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-slugs.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_admin_slugs_options(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-core/admin/bp-core-admin-slugs.php  
  1. function bp_core_admin_slugs_options() { 
  2. $bp =buddypress); 
  3.  
  4. // Get the existing WP pages 
  5. $existing_pages = bp_core_get_directory_page_ids(); 
  6.  
  7. // Set up an array of components (along with component names) that have directory pages. 
  8. $directory_pages = bp_core_admin_get_directory_pages(); 
  9.  
  10. if ( !empty( $directory_pages ) ) : ?> 
  11.  
  12. <h3><?php _e( 'Directories', buddypress ); ?></h3> 
  13.  
  14. <p><?php _e( 'Associate a WordPress Page with each BuddyPress component directory.', buddypress ); ?></p> 
  15.  
  16. <table class="form-table"> 
  17. <tbody> 
  18.  
  19. <?php foreach ( $directory_pages as $name => $label ) : ?> 
  20.  
  21. <tr valign="top"> 
  22. <th scope="row"> 
  23. <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label> 
  24. </th> 
  25.  
  26. <td> 
  27.  
  28.  
  29. <?php echo wp_dropdown_pages( array( 
  30. 'name' => 'bp_pages[' . esc_attr( $name ) . ']',  
  31. 'echo' => false,  
  32. 'show_option_none' => __( '- None -', buddypress ),  
  33. 'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false 
  34. ) ); ?> 
  35.  
  36. <?php if ( !empty( $existing_pages[$name] ) ) : ?> 
  37.  
  38. <a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View', buddypress ); ?></a> 
  39.  
  40. <?php endif; ?> 
  41.  
  42. <?php if ( ! bp_is_root_blog() ) restore_current_blog(); ?> 
  43.  
  44. </td> 
  45. </tr> 
  46.  
  47.  
  48. <?php endforeach ?> 
  49.  
  50. <?php 
  51.  
  52. /** 
  53. * Fires after the display of default directories. 
  54. * Allows plugins to add their own directory associations. 
  55. * @since 1.5.0 
  56. */ 
  57.  
  58. </tbody> 
  59. </table> 
  60.  
  61. <?php 
  62.  
  63. endif; 
  64.  
  65. /** Static Display ********************************************************/ 
  66.  
  67. $static_pages = bp_core_admin_get_static_pages(); 
  68.  
  69. if ( !empty( $static_pages ) ) : ?> 
  70.  
  71. <h3><?php _e( 'Registration', buddypress ); ?></h3> 
  72.  
  73. <?php if ( bp_get_signup_allowed() ) : ?> 
  74. <p><?php _e( 'Associate WordPress Pages with the following BuddyPress Registration pages.', buddypress ); ?></p> 
  75. <?php else : ?> 
  76. <?php if ( is_multisite() ) : ?> 
  77. <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> 
  78. <?php else : ?> 
  79. <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> 
  80. <?php endif; ?> 
  81. <?php endif; ?> 
  82.  
  83. <table class="form-table"> 
  84. <tbody> 
  85.  
  86. <?php if ( bp_get_signup_allowed() ) : foreach ( $static_pages as $name => $label ) : ?> 
  87.  
  88. <tr valign="top"> 
  89. <th scope="row"> 
  90. <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label> 
  91. </th> 
  92.  
  93. <td> 
  94.  
  95.  
  96. <?php echo wp_dropdown_pages( array( 
  97. 'name' => 'bp_pages[' . esc_attr( $name ) . ']',  
  98. 'echo' => false,  
  99. 'show_option_none' => __( '- None -', buddypress ),  
  100. 'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false 
  101. ) ) ?> 
  102.  
  103. <?php if ( !empty( $existing_pages[$name] ) ) : ?> 
  104.  
  105. <a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View', buddypress ); ?></a> 
  106.  
  107. <?php endif; ?> 
  108.  
  109. <?php if ( ! bp_is_root_blog() ) restore_current_blog(); ?> 
  110.  
  111. </td> 
  112. </tr> 
  113.  
  114. <?php endforeach; endif; ?> 
  115.  
  116. <?php 
  117.  
  118. /** 
  119. * Fires after the display of default static pages for BuddyPress setup. 
  120. * @since 1.5.0 
  121. */ 
  122.  
  123. </tbody> 
  124. </table> 
  125.  
  126. <?php 
  127. endif;