Changeset 11927
- Timestamp:
- 04/02/2018 03:51:24 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-actions.php
r11766 r11927 108 108 } 109 109 110 /**111 * Catches and processes account activation requests.112 *113 * @since 3.0.0114 */115 function bp_members_action_activate_account() {116 if ( ! bp_is_current_component( 'activate' ) ) {117 return;118 }119 120 if ( is_user_logged_in() ) {121 return;122 }123 124 if ( ! empty( $_POST['key'] ) ) {125 $key = wp_unslash( $_POST['key'] );126 127 // Backward compatibility with templates using `method="get"` in their activation forms.128 } elseif ( ! empty( $_GET['key'] ) ) {129 $key = wp_unslash( $_GET['key'] );130 }131 132 if ( empty( $key ) ) {133 return;134 }135 136 $bp = buddypress();137 138 /**139 * Filters the activation signup.140 *141 * @since 1.1.0142 *143 * @param bool|int $value Value returned by activation.144 * Integer on success, boolean on failure.145 */146 $user = apply_filters( 'bp_core_activate_account', bp_core_activate_signup( $key ) );147 148 // If there were errors, add a message and redirect.149 if ( ! empty( $user->errors ) ) {150 bp_core_add_message( $user->get_error_message(), 'error' );151 bp_core_redirect( trailingslashit( bp_get_root_domain() . '/' . $bp->pages->activate->slug ) );152 }153 154 bp_core_add_message( __( 'Your account is now active!', 'buddypress' ) );155 bp_core_redirect( add_query_arg( 'activated', '1', bp_get_activation_page() ) );156 157 }158 add_action( 'bp_actions', 'bp_members_action_activate_account' );159 160 110 /* 161 111 * Unhooked in 1.6.0 - moved to settings 162 112 * add_action( 'bp_actions', 'bp_core_action_delete_user' ); 163 113 */ 164 165 /**166 * Redirect to a random member page when visiting a ?random-member URL.167 *168 * @since 1.0.0169 */170 function bp_core_get_random_member() {171 if ( ! isset( $_GET['random-member'] ) )172 return;173 174 $user = bp_core_get_users( array( 'type' => 'random', 'per_page' => 1 ) );175 bp_core_redirect( bp_core_get_user_domain( $user['users'][0]->id ) );176 }177 add_action( 'bp_actions', 'bp_core_get_random_member' ); -
trunk/src/bp-members/classes/class-bp-members-component.php
r11360 r11927 60 60 'actions', 61 61 'filters', 62 'screens',63 62 'template', 64 63 'adminbar', … … 78 77 79 78 parent::includes( $includes ); 79 } 80 81 /** 82 * Late includes method. 83 * 84 * Only load up certain code when on specific pages. 85 * 86 * @since 3.0.0 87 */ 88 public function late_includes() { 89 // Bail if PHPUnit is running. 90 if ( defined( 'BP_TESTS_DIR' ) ) { 91 return; 92 } 93 94 // Members. 95 if ( bp_is_members_component() ) { 96 // Actions - Random member handler. 97 if ( isset( $_GET['random-member'] ) ) { 98 require $this->path . 'bp-members/actions/random.php'; 99 } 100 101 // Screens - Directory. 102 if ( bp_is_members_directory() ) { 103 require $this->path . 'bp-members/screens/directory.php'; 104 } 105 } 106 107 // Members - User main nav screen. 108 if ( bp_is_user() ) { 109 require $this->path . 'bp-members/screens/profile.php'; 110 } 111 112 // Members - Theme compatibility. 113 if ( bp_is_members_component() || bp_is_user() ) { 114 new BP_Members_Theme_Compat(); 115 } 116 117 // Registration / Activation. 118 if ( bp_is_register_page() || bp_is_activation_page() ) { 119 if ( bp_is_register_page() ) { 120 require $this->path . 'bp-members/screens/register.php'; 121 } else { 122 require $this->path . 'bp-members/screens/activate.php'; 123 } 124 125 // Theme compatibility. 126 new BP_Registration_Theme_Compat(); 127 } 80 128 } 81 129 -
trunk/src/bp-members/screens/register.php
r11926 r11927 1 1 <?php 2 2 /** 3 * BuddyPress Member Screens. 4 * 5 * Handlers for member screens that aren't handled elsewhere. 3 * Members: Register screen handler 6 4 * 7 5 * @package BuddyPress 8 6 * @subpackage MembersScreens 9 * @since 1.5.07 * @since 3.0.0 10 8 */ 11 12 // Exit if accessed directly.13 defined( 'ABSPATH' ) || exit;14 15 /**16 * Handle the display of the profile page by loading the correct template file.17 *18 * @since 1.5.019 */20 function bp_members_screen_display_profile() {21 22 /**23 * Fires right before the loading of the Member profile screen template file.24 *25 * @since 1.5.026 */27 do_action( 'bp_members_screen_display_profile' );28 29 /**30 * Filters the template to load for the Member profile page screen.31 *32 * @since 1.5.033 *34 * @param string $template Path to the Member template to load.35 */36 bp_core_load_template( apply_filters( 'bp_members_screen_display_profile', 'members/single/home' ) );37 }38 39 /**40 * Handle the display of the members directory index.41 *42 * @since 1.5.043 */44 function bp_members_screen_index() {45 if ( bp_is_members_directory() ) {46 bp_update_is_directory( true, 'members' );47 48 /**49 * Fires right before the loading of the Member directory index screen template file.50 *51 * @since 1.5.052 */53 do_action( 'bp_members_screen_index' );54 55 /**56 * Filters the template to load for the Member directory page screen.57 *58 * @since 1.5.059 *60 * @param string $value Path to the member directory template to load.61 */62 bp_core_load_template( apply_filters( 'bp_members_screen_index', 'members/index' ) );63 }64 }65 add_action( 'bp_screens', 'bp_members_screen_index' );66 9 67 10 /** … … 287 230 } 288 231 add_action( 'bp_screens', 'bp_core_screen_signup' ); 289 290 /**291 * Handle the loading of the Activate screen.292 *293 * @since 1.1.0294 */295 function bp_core_screen_activation() {296 297 // Bail if not viewing the activation page.298 if ( ! bp_is_current_component( 'activate' ) ) {299 return false;300 }301 302 // If the user is already logged in, redirect away from here.303 if ( is_user_logged_in() ) {304 305 // If activation page is also front page, set to members directory to306 // avoid an infinite loop. Otherwise, set to root domain.307 $redirect_to = bp_is_component_front_page( 'activate' )308 ? bp_get_members_directory_permalink()309 : bp_get_root_domain();310 311 // Trailing slash it, as we expect these URL's to be.312 $redirect_to = trailingslashit( $redirect_to );313 314 /**315 * Filters the URL to redirect logged in users to when visiting activation page.316 *317 * @since 1.9.0318 *319 * @param string $redirect_to URL to redirect user to.320 */321 $redirect_to = apply_filters( 'bp_loggedin_activate_page_redirect_to', $redirect_to );322 323 // Redirect away from the activation page.324 bp_core_redirect( $redirect_to );325 }326 327 // Get BuddyPress.328 $bp = buddypress();329 330 /**331 * Filters the template to load for the Member activation page screen.332 *333 * @since 1.1.1334 *335 * @param string $value Path to the Member activation template to load.336 */337 bp_core_load_template( apply_filters( 'bp_core_template_activate', array( 'activate', 'registration/activate' ) ) );338 }339 add_action( 'bp_screens', 'bp_core_screen_activation' );340 341 /** Theme Compatibility *******************************************************/342 343 new BP_Members_Theme_Compat();344 new BP_Registration_Theme_Compat(); -
trunk/tests/phpunit/includes/loader.php
r11926 r11927 24 24 * loaded at the same time to prevent weird load order issues. 25 25 */ 26 $components = array( 'activity', 'groups', 'me ssages', 'settings' );26 $components = array( 'activity', 'groups', 'members', 'messages', 'settings' ); 27 27 foreach ( $components as $component ) { 28 28 add_action( "bp_{$component}_includes", function() use ( $component ) {
Note: See TracChangeset
for help on using the changeset viewer.