bp_registration_options_bp_core_register_account

Set up our user upon activation, email appropriate people.

Description

bp_registration_options_bp_core_register_account( (int) $user_id ); 

Parameters (1)

0. $user_id (int)
The user id.

Usage

  1. if ( !function_exists( 'bp_registration_options_bp_core_register_account' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-registration-options/includes/core.php'; 
  3.  
  4. // The user id. 
  5. $user_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_registration_options_bp_core_register_account($user_id); 
  9.  

Defined (1)

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

/includes/core.php  
  1. function bp_registration_options_bp_core_register_account( $user_id ) { 
  2.  
  3. $moderate = get_option( 'bprwg_moderate' ); 
  4.  
  5. if ( $moderate && $user_id > 0 ) { 
  6.  
  7. /** Somehow the WP-FB-AutoConnect plugin uses $_GET['key'] as well for user IDs. Let's check if the value returns a user. */ 
  8.  
  9. /** 
  10. $is_user = get_userdata( $_GET['key'] ); 
  11.   
  12. if ( !$is_user ) { 
  13. return; 
  14. */ 
  15.  
  16.  
  17. $user = get_userdata( $user_id ); 
  18.  
  19. /** This filter is documented in includes/core.php */ 
  20. //$admin_email = apply_filters( 'bprwg_admin_email_addresses', array( get_bloginfo( 'admin_email' ) ) ); 
  21. // Used for BP Notifications. 
  22. $admins = get_users( 'role=administrator' ); 
  23.  
  24. // Add HTML capabilities temporarily. 
  25.  
  26. // If their IP or email is blocked, don't proceed and exit silently. 
  27. //$blockedIPs = get_option( 'bprwg_blocked_ips', array() ); 
  28. //$blockedemails = get_option( 'bprwg_blocked_emails', array() ); 
  29.  
  30. /**if ( in_array( $_SERVER['REMOTE_ADDR'], $blockedIPs ) || in_array( $user->user_email, $blockedemails ) ) { 
  31.   
  32. /** 
  33. * Filters the email content for the admin user when banned IP tries to register. 
  34. * @since 4.2.0 
  35. */ 
  36. /**$message = apply_filters( 'bprwg_banned_user_admin_email', __( 'Someone with a banned IP address or email just tried to register with your site', 'bp-registration-options' ) ); 
  37.   
  38. wp_mail( $admin_email, __( 'Banned member registration attempt', 'bp-registration-options' ), $message ); 
  39.   
  40. // Delete their account thus far. 
  41. if ( is_multisite() ) { 
  42. wpmu_delete_user( $user_id ); 
  43. } else { 
  44. wp_delete_user( $user_id ); 
  45.   
  46. return; 
  47. }*/ 
  48.  
  49. // Set them as in moderation. 
  50.  
  51. /** 
  52. * Filters the SERVER global reported remote address. 
  53. * @since 4.3.0 
  54. * @param string $value IP Address of the user being registered. 
  55. */ 
  56. update_user_meta( $user_id, '_bprwg_ip_address', apply_filters( '_bprwg_ip_address', $_SERVER['REMOTE_ADDR'] ) ); 
  57.  
  58. // Admin email. 
  59. $message = get_option( 'bprwg_admin_pending_message' ); 
  60. $message = str_replace( '[username]', $user->data->user_login, $message ); 
  61. $message = str_replace( '[user_email]', $user->data->user_email, $message ); 
  62.  
  63. array( 
  64. 'user_login' => $user->data->user_login,  
  65. 'user_email' => $user->data->user_email,  
  66. 'message' => $message,  
  67. ); 
  68.  
  69.  
  70. // Set admin notification for new member. 
  71. $enable_notifications = (bool) get_option( 'bprwg_enable_notifications' ); 
  72. if ( bp_is_active( 'notifications' ) && $enable_notifications ) { 
  73. foreach ( $admins as $admin ) { 
  74. bp_notifications_add_notification( array( 
  75. 'user_id' => $admin->ID,  
  76. 'component_name' => bp_registration_options,  
  77. 'component_action' => bp_registration_options,  
  78. 'allow_duplicate' => true,  
  79. ) );