bp_core_screen_activation

Handle the loading of the Activate screen.

Description

bp_core_screen_activation(); 

Usage

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

Defined (1)

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

/bp-members/bp-members-screens.php  
  1. function bp_core_screen_activation() { 
  2.  
  3. // Bail if not viewing the activation page. 
  4. if ( ! bp_is_current_component( 'activate' ) ) { 
  5. return false; 
  6.  
  7. // If the user is already logged in, redirect away from here. 
  8. if ( is_user_logged_in() ) { 
  9.  
  10. // If activation page is also front page, set to members directory to 
  11. // avoid an infinite loop. Otherwise, set to root domain. 
  12. $redirect_to = bp_is_component_front_page( 'activate' ) 
  13.  
  14. // Trailing slash it, as we expect these URL's to be. 
  15. $redirect_to = trailingslashit( $redirect_to ); 
  16.  
  17. /** 
  18. * Filters the URL to redirect logged in users to when visiting activation page. 
  19. * @since 1.9.0 
  20. * @param string $redirect_to URL to redirect user to. 
  21. */ 
  22. $redirect_to = apply_filters( 'bp_loggedin_activate_page_redirect_to', $redirect_to ); 
  23.  
  24. // Redirect away from the activation page. 
  25. bp_core_redirect( $redirect_to ); 
  26.  
  27. // Grab the key (the old way). 
  28. $key = isset( $_GET['key'] ) ? $_GET['key'] : ''; 
  29.  
  30. // Grab the key (the new way). 
  31. if ( empty( $key ) ) { 
  32. $key = bp_current_action(); 
  33.  
  34. // Get BuddyPress. 
  35. $bp =buddypress); 
  36.  
  37. // We've got a key; let's attempt to activate the signup. 
  38. if ( ! empty( $key ) ) { 
  39.  
  40. /** 
  41. * Filters the activation signup. 
  42. * @since 1.1.0 
  43. * @param bool|int $value Value returned by activation. 
  44. * Integer on success, boolean on failure. 
  45. */ 
  46.  
  47. // If there were errors, add a message and redirect. 
  48. if ( ! empty( $user->errors ) ) { 
  49. bp_core_add_message( $user->get_error_message(), error ); 
  50. bp_core_redirect( trailingslashit( bp_get_root_domain() . '/' . $bp->pages->activate->slug ) ); 
  51.  
  52. bp_core_add_message( __( 'Your account is now active!', buddypress ) ); 
  53. $bp->activation_complete = true; 
  54.  
  55. /** 
  56. * Filters the template to load for the Member activation page screen. 
  57. * @since 1.1.1 
  58. * @param string $value Path to the Member activation template to load. 
  59. */ 
  60. bp_core_load_template( apply_filters( 'bp_core_template_activate', array( 'activate', 'registration/activate' ) ) );