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

Fix importer not finding existing users if their username is different #7361

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

m1r0
Copy link
Member

@m1r0 m1r0 commented Dec 5, 2023

The importer looks for existing users by username only. This causes an issue when the user has created a user, on a new instance, with the same email but with a different username.

Proposed Changes

Fix the importer to look for existing users by their email as well.

Testing Instructions

  1. Go to Sensei LMS -> Tools -> Export Content and do an export.
  2. Note some of the usernames and emails that are exported. For example username: test, email: test@example.com.
  3. Create a new WP instance.
  4. Create a user with an email of some of the exported users but use a different username. For example username: handsome_potato, email: test@example.com.
  5. Go to Sensei LMS -> Tools -> Import Content and import the data.
  6. There should be no error saying "Sorry, that email address is already used".
  7. The data should be associated correctly to the user.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@m1r0 m1r0 added the [Type] Bug label Dec 5, 2023
@m1r0 m1r0 added this to the 4.19.3 milestone Dec 5, 2023
@m1r0 m1r0 requested a review from a team December 5, 2023 22:43
@m1r0 m1r0 self-assigned this Dec 5, 2023
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #7361 (7033f01) into trunk (7a66daa) will increase coverage by 0.00%.
Report is 6 commits behind head on trunk.
The diff coverage is 38.46%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              trunk    #7361   +/-   ##
=========================================
  Coverage     50.73%   50.73%           
- Complexity    11144    11147    +3     
=========================================
  Files           613      613           
  Lines         47037    47044    +7     
  Branches        404      404           
=========================================
+ Hits          23862    23866    +4     
- Misses        22848    22851    +3     
  Partials        327      327           
Files Coverage Δ
...des/data-port/class-sensei-data-port-utilities.php 89.95% <100.00%> (+0.17%) ⬆️
...es/blocks/course-theme/class-course-navigation.php 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa90079...7033f01. Read the comment docs.

Copy link
Contributor

@renatho renatho left a comment

Choose a reason for hiding this comment

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

Looks good and works well!

@m1r0 m1r0 merged commit cc9b3d3 into trunk Dec 12, 2023
24 of 26 checks passed
@m1r0 m1r0 deleted the fix/importer-user-not-found branch December 12, 2023 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants