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

Linking an EDD Cusomter to a WP User does not work if autocomplete tool not used #4739

Closed
bcole808 opened this Issue Jun 29, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@bcole808
Contributor

bcole808 commented Jun 29, 2016

Problem

When editing EDD Customer details, there is a field to enter a user_login in order to link an EDD Customer to a WordPress user. Currently in order to fill this out, you have to start typing a username and then click on the autocomplete result. This creates a hidden field in the form with the user_id to pair to.

However, if you do not click on the autocomplete option and instead paste in a complete user_login then click "Update Customer" the change is not saved because the hidden field with the user_id is not created. The endpoint in customer-actions.php only checks for the presence of the hidden user_id field and ignores the actual user_login field.

Proposed solution

I propose that a change is made so that either:

A) The endpoint in customer-actions.php should reference the user_login field instead of (or as a fallback for) the user_id field to handle the cases where a user has pasted or typed a complete username without picking one from the dropdown.

or

B) The form field for user_id should be the visible field, so the user can edit it. The field for user_login might be changed to be a button (such as a magnifying glass) next to the user_id input so that it correctly looks like a "lookup tool" to find a user_id by username.

This is the section I am referring to:

screen shot 2016-06-29 at 3 04 48 pm

@cklosowski

This comment has been minimized.

Member

cklosowski commented Jun 29, 2016

This is using our built in ajax_user_search HTML field. Maybe we should
look at improving it overall instead of just on the Customer edit screen.

Chris Klosowski
cklosowski@gmail.com
@cklosowski

On Wed, Jun 29, 2016 at 3:16 PM, Ben Cole notifications@github.com wrote:

Problem

When editing EDD Customer details, there is a field to enter a user_login
in order to link an EDD Customer to a WordPress user. Currently in order to
fill this out, you have to start typing a username and then click on the
autocomplete result. This creates a hidden field in the form with the
user_id to pair to.

However, if you do not click on the autocomplete option and instead paste
in a complete user_login then click "Update Customer" the change is not
saved because the hidden field with the user_id is not created. The
endpoint in customer-actions.php only checks for the presence of the hidden
user_id field and ignores the actual user_login field.
Proposed solution

I propose that a change is made so that either:

A) The endpoint in customer-actions.php should reference the user_login
field instead of (or as a fallback for) the user_id field to handle the
cases where a user has pasted or typed a complete username without picking
one from the dropdown.

or

B) The form field for user_id should be the visible field, so the user
can edit it. The field for user_login might be changed to be a button
(such as a magnifying glass) next to the user_id input so that it
correctly looks like a "lookup tool" to find a user_id by username.
This is the section I am referring to:

[image: screen shot 2016-06-29 at 3 04 48 pm]
https://cloud.githubusercontent.com/assets/5074711/16470396/db3678a4-3e0a-11e6-8180-7232a608b896.png


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#4739,
or mute the thread
https://github.com/notifications/unsubscribe/ABU2LMGuDNmJ-jJbm37qxeFn4IAzSDuCks5qQu7EgaJpZM4JBnyS
.

@cklosowski cklosowski self-assigned this Jun 29, 2016

@cklosowski cklosowski added this to the 2.9 milestone Jun 29, 2016

@pippinsplugins

This comment has been minimized.

Member

pippinsplugins commented Jul 5, 2016

I like the A solution proposed above. If user_id is empty but user_login is not, let's just look up the user via the provided value.

@pippinsplugins pippinsplugins modified the milestones: 2.6.5, 2.9 Jul 5, 2016

@cklosowski cklosowski modified the milestones: 2.6.5, 2.6.6 Jul 20, 2016

@pippinsplugins pippinsplugins modified the milestones: 2.6.6, 2.6.7 Jul 28, 2016

cklosowski added a commit that referenced this issue Aug 31, 2016

@cklosowski

This comment has been minimized.

Member

cklosowski commented Aug 31, 2016

Ok I updated the code to look for the login string, and it supports both login and email address, looks up the user by that field and then assigns the proper user ID, if found. If no user is found with the string provided, an error is returned on page load.

@SDavisMedia

This comment has been minimized.

Contributor

SDavisMedia commented Sep 1, 2016

Confirmed on issue/4739 that simply entering the username or user email address and updating the customer will connect the customer and user. Also checked to make sure the original approach still works. All good. 👍

pippinsplugins added a commit that referenced this issue Sep 1, 2016

Merge pull request #4916 from easydigitaldownloads/issue/4739
Support login/email when changing customer user #4739
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment