-
-
Notifications
You must be signed in to change notification settings - Fork 31
Add Ability to Manually Edit and Upload Comment Avatars #558
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
base: main
Are you sure you want to change the base?
Add Ability to Manually Edit and Upload Comment Avatars #558
Conversation
|
The problem is it isn't uploading to the store, it is uploading to the media library, so this doesn't achieve the stated goal. You are also making it available for all comment tyhpes, which would interfere with other plugins that do avatar uploads. The store is designed to store a unique avatar for each author URL, not for each comment URL, which makes me think. |
…4/wordpress-webmention into feat/manual-avatar-change
I agree with @dshanske here. I think we do not want to have avatars of remote users/sites in the media library. |
|
I'm working on a PR to the store class to add retrieval functionality directly from the store. |
|
So should I close this? |
|
I am not even sure if "manually uploading" is the right approach!? I would prefer something like "force update" to tell the plugin to receive a new avatar from the remote server. |
|
With an image upload you can do too many bad things!? |
|
I think i fixed it now. I did some tests with 3 test users and it seemed to work. Pushing now. |
|
As requested now we have full access to the avatars through Tools panel. We can still modify, refresh and cleanup orphan entries. I also added the functionality to delete the avatar if we delete a user's comment. Of course I have taken into consideration the fact that a user may have more than 1 comments, so if we delete one of them, his avatar will still remain untouched. |
|
@mgiannopoulos24 Don't want to discourage you here, we really appreciate the contributions. We are just figuring out exactly what makes sense. We try to keep the plugin very basic on the plumbing and sometimes realize an idea violates that simplicity principle. @pfefferle has had to hold me back on features at times we both ultimately agreed should be separate. |
|
Absolutely, no problem. I also want to thank you for your time. |
|
I am going to look and figure out more specific feedback. Right now, working on a complementary idea you inspired me to do @mgiannopoulos24 |
|
Complimentary as in it would work with this. |
|
@mgiannopoulos24 If you look at #560 this is the idea your PR made me start pursuing, which is complimentary in the sense thinking about this again caused me to ask if we were doing the right thing by overwriting the original source URL for the image in the first place. Assuming we merge that one, and that requires concurrence, it doesn't affect the idea of loading things into the avatar store manually, or refreshing or otherwise purging, but it is a change in where in the chain things go. Specifically it would now go Avatar Store(if enabled), followed by metadata stored URL(if present)....and then to the other fallbacks. It means that if the store is enabled, then we should be manipulating the store, but if it isn't.... |
|
@mgiannopoulos24 Reading your code, adding a function to retrieve an avatar from the store directly is something we both did, and I think that should stand. Yours is probably simpler than mine, which is probably a good thing as I was considering the possibility there might be deviation in the filenames, which there shouldn't be. Deleting orphaned avatars also makes sense, but we shoudl do this based on $host and $author properties used to generate the URL. |
I will modify it when I can. If you have any other suggestions let me know! |
|
@mgiannopoulos24 I think maybe we should break this into separate PRs. Specifically, the idea of an API endpoint for the avatar store should be explored to see what functionality we want in that as a separate issue. You have a few bugfixes in here that I think should also be separate PRs, such as the inversion of the str_contains with gravatar. |
|
Would you be willing to submit the bug fixes and enhancements to functions to improve behavior separately? I'm going to open an issue to discuss what we might want in an avatar api endpoint. |
|
I could try and break it to separate PR's okay. |
Description
This PR adds the ability for administrators to manually edit the Avatar URL for a comment or upload a new avatar locally using the WordPress Media Library. Previously, this field was read-only and restricted only to comments created via the Webmention protocol.
Related issue
Issue #449
Changes
includes/class-admin.php:enqueue_scriptsto load the WordPress Media Library (wp_enqueue_media) on comment editing screens.save_commentmethod hooked toedit_commentto sanitize and save the avatar meta field when the metabox is submitted.templates/webmention-edit-comment-form.php:if ( 'webmention' === ... )check, making it available for all comment types.disabledattribute to allow manual editing.Testing Instructions
Showcase
Let me know your thoughts on this PR.