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
Town News: Try to avoid using email as display name for authors #374
base: trunk
Are you sure you want to change the base?
Conversation
@@ -696,7 +698,7 @@ private function set_post_author( $post_id, $display_name, $author_meta, $defaul | |||
); | |||
} else { | |||
// Set as a co-author. | |||
$guest_author = $this->coauthorsplus_logic->get_guest_author_by_user_login( $email ); | |||
$guest_author = $this->coauthorsplus_logic->get_guest_author_by_user_login( $display_name ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using $email
was a bug here, nice catch! The create_guest_author used here to create a new co-author uses the sanitized display_name as user_login in case we don't provide the later, so I think to fetch co-authors using $display_name
as user_login we should pass the sanitized version.
$guest_author = $this->coauthorsplus_logic->get_guest_author_by_user_login( $display_name ); | |
$guest_author = $this->coauthorsplus_logic->get_guest_author_by_user_login( sanitize_title( $display_name ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Zak - good catch!
I added sanitization with sanitize_user because I assume that is what the user login is run through when it's created. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user is created as of now with sanitize_title
, but I think it's better to fix it properly and change it there to sanitize_user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I moved the sanitization around a bit to make it more consistent.
I also added tag stripping in bylines – I had a couple of files where the byline was dirty. |
@kariae This one got a bit old. I'm not sure if it is still relevant. What do you think? |
@kariae I think this one can just be closed with no merge. It's so old :) What do you think? |
I noticed that we can risk creating slugs with emails. This does some string juggling to avoid that.
How to test