Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wpa0_user_data filter before creating WP_User #717

Merged
merged 2 commits into from
Aug 15, 2019
Merged

Add wpa0_user_data filter before creating WP_User #717

merged 2 commits into from
Aug 15, 2019

Conversation

horike37
Copy link
Contributor

@horike37 horike37 commented Aug 14, 2019

Changes

Add filter auth0_create_user_data to allow customizing user data before creating WP_User because I would like to separate display_name from username. The current implementation hardcodes the WordPress user_login and display_name to come from the Auth0 username. However, in many cases, those are separated based on naming style in Japan.

References

There is no reference. only this PR.

Testing

  • I included manual testing steps above, if applicable
  • This change adds unit test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

@horike37 horike37 changed the title feat: add wpa0_user_data filter Add wpa0_user_data filter before creating WP_User Aug 14, 2019
Copy link
Contributor

@joshcanhelp joshcanhelp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! A few small changes here and I'll be happy to merge this in.

@@ -84,6 +84,8 @@ public static function create_user( $userinfo, $role = null ) {
'description' => $description,
];

$user_data = apply_filters( 'wpa0_user_data', $user_data, $userinfo, $firstname, $lastname );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming convention for hooks isn't 100% consistent but we've been using auth0_ as the namespace for new ones. Can you update the filter name to auth0_create_user_data to add that namespace and make this more explicit?

Also, the $firstname and $lastname parameters are not necessary since their values are already in the array.

Copy link
Contributor Author

@horike37 horike37 Aug 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshcanhelp
Thank you for review 👍 Happy to hear that this PR will be merged 😄
I just updated all what you pointed. Please check it again.

@joshcanhelp joshcanhelp added this to the 4.0.0 milestone Aug 14, 2019
@joshcanhelp joshcanhelp merged commit efd7de7 into auth0:master Aug 15, 2019
@horike37 horike37 deleted the add-filter-for-userdata branch August 15, 2019 15:19
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants