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: Handle display name with special chars #775

Merged
merged 2 commits into from
Apr 8, 2021
Merged

FIX: Handle display name with special chars #775

merged 2 commits into from
Apr 8, 2021

Conversation

nielslange
Copy link
Member

Fixes #370

Changes

Allow users and guest users to use special characters in the display name.

Steps to test

  1. Create a guest author with a special character in the display name, e.g. Jane | Doe
  2. Open an existing post and add that guest author to it
  3. Verify that the avatar/Gravatar is broken
  4. Check out this PR
  5. Refresh the post page
  6. Add the guest author again
  7. Verify that the avatar/Gravatar is visible

Screenshots

Before:

Screenshot 2021-04-02 at 17 30 01
After:

Screenshot 2021-04-02 at 17 27 45

Copy link
Member

@htdat htdat left a comment

Choose a reason for hiding this comment

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

I commented a trick to workaround below. However, I think if possible, we may consider switching to JSON like what's recommended in #370

co-authors-plus.php Show resolved Hide resolved
Copy link
Member

@htdat htdat left a comment

Choose a reason for hiding this comment

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

LGTM given @nielslange's explanation here #775 (comment)

@rebeccahum
Copy link
Contributor

rebeccahum commented Apr 6, 2021

During testing, it seems to break for me:

Screen Shot 2021-04-06 at 10 33 57 AM

My testing steps:

  1. Create guest author with display name "Test | Pipe"
  2. Go to a post
  3. Assign "Test | Pipe" author.

Edit: You can try to assign any author and it gives a broken row.

@nielslange nielslange changed the title 🐛 FIX: Handle display name with special chars FIX: Handle display name with special chars Apr 7, 2021
@nielslange
Copy link
Member Author

@rebeccahum I'm afraid, I'm unable to reproduce what you;'re seeing on your end. On my end, when using a pipe, the guest author is visible as expected. I tested that both with my existing testing site and with a brand-new testing site.

Screenshot 2021-04-07 at 08 07 30

@rebeccahum
Copy link
Contributor

On a clean WP install, I'm still seeing the same issue:

Screen Shot 2021-04-06 at 7 27 36 PM

WP 5.7
PHP 7.4
Chrome

@nielslange
Copy link
Member Author

@rebeccahum Do you see any errors in the console? Strange enough, I'm using the exact environment and on my end, the fix works as expected. Without seeing what you are seeing, it's a bit tricky to apply changes.

@rebeccahum
Copy link
Contributor

rebeccahum commented Apr 7, 2021

No console errors that stand out for me. Issue is only prevalent when I checkout this PR.

@htdat do you run into the same issue as me in testing?

@htdat
Copy link
Member

htdat commented Apr 8, 2021

@htdat do you run into the same issue as me in testing?
WP 5.7
PHP 7.4
Chrome

Works well for me. I am using the same env.
Maybe providing the content of the relevant AJAX response is helpful? Here is mine:

115 ∣ test-pipe ∣ Test | Pipe ∣  ∣ test-pipe ∣ http://0.gravatar.com/avatar/?s=96&d=mm&r=g 

@rebeccahum
Copy link
Contributor

Ah, looks like the issue was browser cache enabled — it goes away when I disable it.

Copy link
Contributor

@rebeccahum rebeccahum left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@rebeccahum rebeccahum merged commit 371d757 into master Apr 8, 2021
@rebeccahum rebeccahum deleted the fix/#370 branch April 8, 2021 03:53
@nielslange
Copy link
Member Author

Ah, looks like the issue was browser cache enabled — it goes away when I disable it.

I'm glad to hear that it;s working on your end now.

nielslange added a commit that referenced this pull request Apr 9, 2021
This reverts commit 371d757, reversing
changes made to c9ebbd1.
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

Successfully merging this pull request may close these issues.

Pipe character in user meta prevents adding as coauthor
3 participants