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

Autoprovision Username as Alias, rather than Email #1

Open
mrjarbenne opened this issue Jan 14, 2020 · 8 comments
Open

Autoprovision Username as Alias, rather than Email #1

mrjarbenne opened this issue Jan 14, 2020 · 8 comments
Assignees

Comments

@mrjarbenne
Copy link
Member

This issue (see link: psignoret#225) is causing some issues for us because we have additional functionality built out that identifies students by looking at the last four characters of their username to check for numbers.

Additionally, @mentions are a bit of a mess for new users because their username in BuddyPress is overly complicated, taking on the email domain with dashes, and doesn't match our established format:

2020-01-14_15-03-05

Perhaps we can sort this out and create a Pull Request.

@r-a-y
Copy link
Member

r-a-y commented Jan 15, 2020

I've added a new filter so we can manipulate the 'user_login' field before the user is created in WordPress: commit 5890159

This way, we can parse the email address and set the user_login to whatever it is before the @ sign.

I'll send a PR to see what the developer thinks.

@r-a-y
Copy link
Member

r-a-y commented Jan 15, 2020

Just a quick update, I'm already using this filter on production. This will take effect for new users that haven't logged into the Commons before. Let me know if it works or not.

@mrjarbenne
Copy link
Member Author

Awesome. I'll keep an eye out for new users and let you know, and start the process of switching the users who had registered prior to this fix over to our old logic.

@r-a-y
Copy link
Member

r-a-y commented Jan 15, 2020

and start the process of switching the users who had registered prior to this fix over to our old logic.

I can write a script that changes all usernames ending with "hwdsb-on-ca" to remove that portion. Just let me know if changing the 'user_login' will not cause any problems before I do so.

@mrjarbenne
Copy link
Member Author

That would be great. Changing user_login doesn't seem to be causing any issues, I've been changing them in an ongoing way using Brajesh's Change Username plugin we are running.

One other snippet that would be helpful would be to block users from changing their email address, as that is the unique identifier being used to authenticate users. I did see a duplicate user produced because someone had changed their email from the hwdsb domain to gmail.com. I'm already restricting registration to @hwdsb.on.ca, but once they're in, I can't block them from changing it to something else.

@r-a-y
Copy link
Member

r-a-y commented Jan 16, 2020

Just ran a script that changed 1141 user accounts :)

One other snippet that would be helpful would be to block users from changing their email address

I'll look into this. I'm surprised that there isn't an existing WordPress plugin that handles this in the admin area. There probably wouldn't be a BuddyPress one, but this can be accomplished easily.

@mrjarbenne
Copy link
Member Author

I looked and was surprised at the lack of options. Found a few messy hacks on stack overflow to hide the field, and a few others that did way more than what was necessary. Nothing small and clean.

@r-a-y
Copy link
Member

r-a-y commented Jan 16, 2020

I've added a small plugin that disables email address changes here: https://github.com/hwdsb/no-email-change

In the admin area, it uses a messy hack. Adds a readonly attribute and hides the email address field. Super admins can still make changes to user accounts though.

For our site, since the email address and password is not used, I've altered the BuddyPress "Settings > General" template to remove the email address and password form, while leaving the hooks needed for plugins to display their data (like our gdrive).

Side note: I couldn't find our fourteenish theme on Github, but maybe I'm not looking in the right place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants