Skip to content

Commit 04c3d8a

Browse files
committed
UR-4833: Fix membership not assigned and auto login not working
Fire user_registration_validate_form_data with do_action_ref_array() instead of apply_filters_ref_array(). The hook passes &self::$valid_form_data by reference and its return value is discarded, so it is an action in all but name. WP_Hook::apply_filters() does $args[0] = $value before invoking each callback, and because $args[0] is a reference to self::$valid_form_data, that assignment writes through the reference. UR_Form_Validation::validate_form() is registered with add_action() and has no return statement, so as soon as a second callback is attached to the hook, $valid_form_data is overwritten with null and every submitted field is lost. Consequences: user_login became empty and registration failed with empty_user_login, and the membership field was gone so process_membership_after_registration() silently skipped enrollment, leaving an account with no plan, no order and no subscription. do_action_ref_array() sets doing_action, which skips the $args[0] assignment, so nothing is lost.
1 parent 902e10e commit 04c3d8a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

includes/frontend/class-ur-frontend-form-handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static function handle_form( $form_data, $form_id ) {
9999
*
100100
* @return array
101101
*/
102-
apply_filters_ref_array(
102+
do_action_ref_array(
103103
'user_registration_validate_form_data',
104104
array(
105105
&self::$valid_form_data,

0 commit comments

Comments
 (0)