bp_registration_options_settings

Options page for settings and messages to use.

Description

bp_registration_options_settings(); 

Usage

  1. if ( !function_exists( 'bp_registration_options_settings' ) ) { 
  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_settings(); 
  7.  

Defined (1)

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

/includes/admin.php  
  1. function bp_registration_options_settings() { 
  2.  
  3. // Check for already saved values. 
  4. $bp_moderate = get_option( 'bprwg_moderate' ); 
  5. $privacy_network = get_option( 'bprwg_privacy_network' ); 
  6. $enable_notifications = get_option( 'bprwg_enable_notifications' ); 
  7. $activate_message = get_option( 'bprwg_activate_message' ); 
  8. $approved_message = get_option( 'bprwg_approved_message' ); 
  9. $denied_message = get_option( 'bprwg_denied_message' ); 
  10. $admin_pending_message = get_option( 'bprwg_admin_pending_message' ); 
  11. $user_pending_message = get_option( 'bprwg_user_pending_message' ); 
  12.  
  13. if ( ! $activate_message ) { 
  14. $activate_message = __( 'Your membership account is awaiting approval by the site administrator. You will not be able to fully interact with the social aspects of this website until your account is approved. Once approved or denied you will receive an email notice.', 'bp-registration-options' ); 
  15.  
  16. update_option( 'bprwg_activate_message', $activate_message ); 
  17.  
  18. if ( ! $approved_message ) { 
  19. $approved_message = sprintf( 
  20. __( 'Hi [username], your member account at %s has been approved! You can now login and start interacting with the rest of the community...', 'bp-registration-options' ),  
  21. get_bloginfo( 'url' ) 
  22. ); 
  23.  
  24. update_option( 'bprwg_approved_message', $approved_message ); 
  25.  
  26. if ( ! $denied_message ) { 
  27. $denied_message = sprintf( 
  28. __( 'Hi [username], we regret to inform you that your member account at %s has been denied...', 'bp-registration-options' ),  
  29. get_bloginfo( 'url' ) 
  30. ); 
  31.  
  32. update_option( 'bprwg_denied_message', $denied_message ); 
  33.  
  34. if ( ! $admin_pending_message ) { 
  35. $admin_pending_message = sprintf( 
  36. __( '[username] ( [user_email] ) would like to become a member of your website. To accept or reject their request, please go to %s', 'bp-registration-options' ),  
  37. '<a href="' . admin_url( '/admin.php?page=bp_registration_options_member_requests' ) . '">' . __( 'Member Requests', 'bp-registration-options' ) . '</a>' 
  38. ); 
  39.  
  40. update_option( 'bprwg_admin_pending_message', $admin_pending_message ); 
  41.  
  42. if ( ! $user_pending_message ) { 
  43. $user_pending_message = sprintf( 
  44. __( 'Hi [username], your account at %s is currently pending approval.', 'bp-registration-options' ),  
  45. get_bloginfo( 'url' ) 
  46. ); 
  47.  
  48. update_option( 'bprwg_denied_message', $user_pending_message ); 
  49. ?> 
  50.  
  51. <div class="wrap gensettings"> 
  52.  
  53. <form method="post"> 
  54. <?php wp_nonce_field( 'bp_reg_options_check' ); ?> 
  55.  
  56. <?php 
  57.  
  58. /** 
  59. * Fires before the general settings form output, inside the form tag. 
  60. * @since 4.2.0 
  61. */ 
  62.  
  63. <p> 
  64. <input type="checkbox" id="bp_moderate" name="bp_moderate" value="1" <?php checked( $bp_moderate, '1' ); ?>/> 
  65. <label for="bp_moderate"> 
  66. <strong> 
  67. <?php esc_html_e( 'Moderate New Members', 'bp-registration-options' ); ?> 
  68. </strong> (<?php esc_html_e( 'Every new member will have to be approved by an administrator before they can interact with BuddyPress/bbPress components.', 'bp-registration-options' ); ?>) 
  69. </label> 
  70. </p> 
  71.  
  72. <p> 
  73. <input type="checkbox" id="privacy_network" name="privacy_network" value="1" <?php checked( $privacy_network, '1' ); ?>/> 
  74. <label for="privacy_network"> 
  75. <?php esc_html_e( 'Only registered or approved members can view BuddyPress/bbPress pages (Private Network).', 'bp-registration-options' ); ?> 
  76. </label> 
  77. </p> 
  78.  
  79. <p> 
  80. <input type="checkbox" id="enable_notifications" name="enable_notifications" value="1" <?php checked( $enable_notifications, '1' ); ?>/> 
  81. <label for="enable_notifications"> 
  82. <?php esc_html_e( 'Add new user notification to admin user account BuddyPress notification inbox.', 'bp-registration-options' ); ?> 
  83. </label> 
  84. </p> 
  85.  
  86. <table> 
  87. <tr> 
  88. <td class="alignright"> 
  89. <label for="activate_message"><?php esc_html_e( 'Activate & Profile Alert Message:', 'bp-registration-options' ); ?></label> 
  90. </td> 
  91. <td> 
  92. <textarea id="activate_message" name="activate_message"><?php echo stripslashes( $activate_message ); ?></textarea> 
  93. </td> 
  94. </tr> 
  95. <tr> 
  96. <td class="alignright"> 
  97. <label for="approved_message"><?php esc_html_e( 'Account Approved Email:', 'bp-registration-options' ); ?></label> 
  98. </td> 
  99. <td> 
  100. <textarea id="approved_message" name="approved_message"><?php echo stripslashes( $approved_message );?></textarea> 
  101. </td> 
  102. </tr> 
  103. <tr> 
  104. <td class="alignright"> 
  105. <label for="denied_message"><?php esc_html_e( 'Account Denied Email:', 'bp-registration-options' ); ?></label> 
  106. </td> 
  107. <td> 
  108. <textarea id="denied_message" name="denied_message"><?php echo stripslashes( $denied_message );?></textarea> 
  109. </td> 
  110. </tr> 
  111. <tr> 
  112. <td class="alignright"> 
  113. <label for="admin_pending_message"><?php esc_html_e( 'Admin Pending Email Message:', 'bp-registration-options' ); ?></label> 
  114. </td> 
  115. <td> 
  116. <textarea id="admin_pending_message" name="admin_pending_message"><?php echo stripslashes( $admin_pending_message );?></textarea> 
  117. </td> 
  118. </tr> 
  119. <tr> 
  120. <td class="alignright"> 
  121. <label for="user_pending_message"><?php esc_html_e( 'User Pending Email Message:', 'bp-registration-options' ); ?></label> 
  122. </td> 
  123. <td> 
  124. <textarea id="user_pending_message" name="user_pending_message"><?php echo stripslashes( $user_pending_message );?></textarea> 
  125. </td> 
  126. </tr> 
  127. <tr> 
  128. <td></td> 
  129. <td class="alignright"> 
  130. <table width="100%"> 
  131. <tr> 
  132. <td> 
  133. <?php esc_html_e( 'Short Code Key: [username], [user_email]', 'bp-registration-options' ); ?> 
  134. </td> 
  135. <td class="alignright"> 
  136. <input type="submit" id="reset_messages" name="reset_messages" class="button button-secondary" value="<?php esc_attr_e( 'Reset Messages', 'bp-registration-options' ); ?>" /> 
  137. </td> 
  138. </tr> 
  139. </table> 
  140. </td> 
  141. </tr> 
  142. </table> 
  143.  
  144. <?php 
  145.  
  146. /** 
  147. * Fires after the general settings form output, inside the form tag. 
  148. * @since 4.2.0 
  149. */ 
  150.  
  151. <button class="button button-primary" name="save_general" value="save_general"><?php esc_attr_e( 'Save Options', 'bp-registration-options' ); ?></button> 
  152. </form> 
  153. </div> 
  154.