bp_registration_options_member_requests

Options page for managing pending members.

Description

bp_registration_options_member_requests(); 

Usage

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

Defined (1)

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

/includes/admin.php  
  1. function bp_registration_options_member_requests() { 
  2. ?> 
  3.  
  4. <div class="wrap"> 
  5. <?php 
  6.  
  7.  
  8. if ( $member_requests > 0 ) { ?> 
  9.  
  10. <form method="POST" name="bprwg"> 
  11. <?php 
  12.  
  13. /** 
  14. * Fires before the pending members list output, inside the form tag. 
  15. * @since 4.2.0 
  16. */ 
  17.  
  18. wp_nonce_field( 'bp_reg_options_check' ); ?> 
  19.  
  20. <p><?php esc_html_e( 'Please approve or deny the following new members:', 'bp-registration-options' ); ?></p> 
  21.  
  22. <table class="widefat"> 
  23. <thead> 
  24. <tr> 
  25. <th id="cb" class="manage-column column-cb check-column" scope="col"> 
  26. <label><input type="checkbox" id="bp_checkall_top" name="checkall" /></label> 
  27. </th> 
  28. <th><?php esc_html_e( 'Photo', 'bp-registration-options' ); ?></th> 
  29. <th><?php esc_html_e( 'Name', 'bp-registration-options' ); ?></th> 
  30. <th><?php esc_html_e( 'Email', 'bp-registration-options' ); ?></th> 
  31. <th><?php esc_html_e( 'Created', 'bp-registration-options' ); ?></th> 
  32. <th><?php esc_html_e( 'Additional Data', 'bp-registration-options' ); ?></th> 
  33. </tr> 
  34. </thead> 
  35. <?php 
  36.  
  37. $odd = true; 
  38.  
  39. // Get paged value, determine total pages, and calculate start_from value for offset. 
  40. $page = ( isset( $_GET['p'] ) ) ? $_GET['p'] : 1; 
  41. $total_pages = ceil( $member_requests / 20 ); // TODO: Test pagination. 
  42. $start_from = ( $page - 1 ) * 20; 
  43.  
  44. $pending_users = bp_registration_get_pending_users( $start_from ); 
  45.  
  46. foreach ( $pending_users as $pending ) { 
  47. if ( class_exists( 'BP_Core_User' ) ) { 
  48. $user = new BP_Core_User( $pending->user_id ); 
  49.  
  50. $user_data = get_userdata( $pending->user_id ); 
  51.  
  52. if ( $odd ) { ?> 
  53. <tr class="alternate"> 
  54. <?php 
  55. $odd = false; 
  56. } else { ?> 
  57. <tr> 
  58. <?php 
  59. $odd = true; 
  60. ?> 
  61. <th class="check-column" scope="row"> 
  62. <label><input type="checkbox" class="bpro_checkbox" id="bp_member_check_<?php echo esc_attr( $pending->user_id ); ?>" name="bp_member_check[]" value="<?php echo esc_attr( $pending->user_id ); ?>" /></label> 
  63. </th> 
  64. <td> 
  65. <?php if ( isset( $user ) ) { ?> 
  66. <a target="_blank" href="<?php echo esc_attr( $user->user_url ); ?>"> 
  67. <?php echo $user->avatar_mini; ?> 
  68. </a> 
  69. <?php } ?> 
  70. </td> 
  71. <td> 
  72. <?php if ( isset( $user ) ) { ?> 
  73. <strong><a target="_blank" href="<?php echo esc_attr( $user->user_url ); ?>"> 
  74. <?php 
  75. if ( ! empty( $user->fullname ) ) { 
  76. echo $user->fullname; 
  77. } else { 
  78. echo $user->profile_data['user_login']; 
  79. ?> 
  80. </a></strong> 
  81. <?php } else { 
  82. echo $user_data->user_login; 
  83. } ?> 
  84. </td> 
  85. <td> 
  86. <a href="mailto:<?php echo $user_data->data->user_email;?>"> 
  87. <?php echo $user_data->data->user_email; ?> 
  88. </a> 
  89. </td> 
  90. <td> 
  91. <?php echo $user_data->data->user_registered; ?> 
  92. </td> 
  93. <td> 
  94. <?php 
  95.  
  96. /** 
  97. * Fires in the last table cell in pending member list. 
  98. * @since 4.3.0 
  99. * @param int $value Pending user ID. 
  100. */ 
  101. do_action( 'bpro_hook_member_item_additional_data', $pending->user_id ); ?> 
  102. </td> 
  103. </tr> 
  104. <?php 
  105.  
  106. /** 
  107. * Fires after an individual pending member table row item. 
  108. * @since 4.3.0 
  109. */ 
  110. ?> 
  111. <tfoot> 
  112. <tr> 
  113. <th class="manage-column column-cb check-column" scope="col"><label><input type="checkbox" id="bp_checkall_bottom" name="checkall" /></label></th> 
  114. <th><?php esc_html_e( 'Photo', 'bp-registration-options' ); ?></th> 
  115. <th><?php esc_html_e( 'Name', 'bp-registration-options' ); ?></th> 
  116. <th><?php esc_html_e( 'Email', 'bp-registration-options' ); ?></th> 
  117. <th><?php esc_html_e( 'Created', 'bp-registration-options' ); ?></th> 
  118. <th><?php esc_html_e( 'Additional Data', 'bp-registration-options' ); ?></th> 
  119. </tr> 
  120. </tfoot> 
  121. </table> 
  122.  
  123. <p> 
  124. <button class="button button-primary" name="moderate" value="approve" id="bpro_approve"><?php esc_html_e( 'Approve', 'bp-registration-options' ); ?></button> 
  125. <button class="button button-secondary" name="moderate" value="deny" id="bpro_deny"><?php esc_html_e( 'Deny', 'bp-registration-options' ); ?></button> 
  126. <?php /**<button class="button button-secondary" name="moderate" value="ban" id="bpro_ban" disabled><?php esc_html_e( 'Ban', 'bp-registration-options' ); </button> */ ?> 
  127. </p> 
  128.  
  129. <?php if ( $total_pages > 1 ) { 
  130. $current = ( ! empty( $_GET['p'] ) ) ? $_GET['p'] : 1; 
  131. echo '<p>' . esc_html__( 'Pagination: ', 'bp-registration-options' ); 
  132. for ( $i = 1; $i <= $total_pages; $i++ ) { 
  133. $classes = ( $i == $current ) ? 'bpro_pagination bpro_current wp-ui-highlight' : 'bpro_pagination'; 
  134. $classes = 'class="' . $classes . '"'; 
  135. printf( 
  136. '<a href="%s" %s>%s</a> ',  
  137. esc_url( add_query_arg( 'p', $i ) ),  
  138. $classes,  
  139. $i 
  140. ); 
  141. echo '</p>'; 
  142.  
  143. /** 
  144. * Fires after the pending members list output, inside the form tag. 
  145. * @since 4.2.0 
  146. */ 
  147.  
  148. </form> 
  149.  
  150. <?php } else { 
  151. echo '<p><strong>' . esc_html__( 'No new members to approve.', 'bp-registration-options' ) . '</strong></p>'; 
  152. ?> 
  153. </div> <!--End Wrap--> 
  154.  
  155. <?php