Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#53992 closed enhancement (fixed)

Lets add WP_User object to "registration_redirect" filter

Reported by: collizo4sky's profile Collizo4sky Owned by: davidbaumwald's profile davidbaumwald
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Login and Registration Keywords: has-patch commit
Focuses: Cc:

Description

I am the maintainer of Peters login redirect plugin. One of the most request feature is to redirect users after registration based on certain user characteristics.

Please, I want

$redirect_to = apply_filters( 'registration_redirect', $registration_redirect );

To change to

$redirect_to = apply_filters( 'registration_redirect', $registration_redirect, $errors );

Attachments (2)

53992.patch (696 bytes) - added by aadilali 3 years ago.
I have crated the patch for this.
53992-alt.patch (811 bytes) - added by aadilali 3 years ago.
Patch with @since note

Download all attachments as: .zip

Change History (18)

#1 @mukesh27
3 years ago

  • Component changed from General to Login and Registration

#2 @mukesh27
3 years ago

  • Keywords needs-patch added

Hi there!

If we add new argument then we also need to add document for it. Also i think we have to change that $errors variable with proper name so other don't get confuse.

#3 @Collizo4sky
3 years ago

@mukesh27 totally agreed. Currently away from my computer.

If you can submit a patch, that would be great.

#4 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 5.9

@aadilali
3 years ago

I have crated the patch for this.

#5 @aadilali
3 years ago

  • Keywords has-patch needs-testing added; needs-patch removed
  • Resolution set to invalid
  • Status changed from new to closed

Hi,

Patch has been added but it need testing.

#6 @aadilali
3 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

#7 follow-up: @mukesh27
3 years ago

@aadilali thanks for the patch.

I think we have to add a @since note for the new filter parameter

Last edited 3 years ago by mukesh27 (previous) (diff)

#8 in reply to: ↑ 7 @aadilali
3 years ago

Replying to mukesh27:

@aadilali thanks for the patch.

I think we have to add a @since note new filter parameter

Should I add @since note and update the patch?

@aadilali
3 years ago

Patch with @since note

This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.


2 years ago

#10 @hellofromTonya
2 years ago

  • Keywords needs-testing removed

This patch is not changing redirection functionality. Rather, it's passing the errors to hooked callbacks. In today's test scrub, it was determined that manual testing is not needed. Why? apply_filters() is well tested and the passing of another variable/data item is known to work.

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


2 years ago

#13 @audrasjb
2 years ago

  • Keywords commit added

Patch refreshed in the PR above. Tests are passing well.
Marking for commit.

#14 @davidbaumwald
2 years ago

  • Owner set to davidbaumwald
  • Status changed from reopened to reviewing

#15 @davidbaumwald
2 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 52091:

Login and Registration: Pass $errors parameter to registration_redirect filter.

On user registration, the $errors variable is the result of register_new_user which contains either the newly registered user's ID on success or a WP_Error object on failure. This change passes that context to the registration_redirect filter.

Props Collizo4sky, aadilali, mukesh27, audrasjb.
Fixes #53992.

dream-encode commented on PR #1851:


2 years ago
#16

Committed to core via changeset https://core.trac.wordpress.org/changeset/52091

Note: See TracTickets for help on using tickets.