Opened 7 years ago
Closed 6 years ago
#3572 closed enhancement (fixed)
Allow users to edit their own notes
Reported by: | keesiemeijer | Owned by: | coffee2code |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Developer Hub | Keywords: | has-patch has-screenshots |
Cc: |
Description
Users should be able to edit their own user contributed notes.
See this comment
The patch adds the ability for users to edit their own contributed notes.
Users can only edit a note if it's awaiting moderation. The endpoint reference/comment/edit/{comment_ID}
is created for users to edit their notes in the front end of the site. You're redirected to the home page (from this endpoint) if the note doesn't exist, or you don't have the right edit permissions. A new template comments-edit.php
is used for the edit note form.
This patch also adds the following rules to the feedback form (similar to the note form).
- This form is not for support requests, spam, bug reports, complaints, or self-promotion. Entries of this nature will be deleted.
- NOTE: All contributions are licensed under GFDL and are moderated before appearing on the site.
Related: #1504
Attachments (11)
Change History (23)
#3
@
7 years ago
@netweb Thanks.
Patch 3572.2.patch adds the following improvements
- Adds a nonce field to the edit comment form.
- Verifies the nonce when updating a comment.
- Adds a notice to the edited note.
- Improves scrolling to notes for logged in users.
#4
@
7 years ago
- Keywords needs-refresh added
FYI, there's some unrelated changes in 3572.2.patch, there should be no changes to the package.json
file, and also don't include the package-lock.json
file in the patch.
#5
@
7 years ago
- Keywords needs-refresh removed
In patch 3572.3.patch the package.json
file is restored and package-lock.json
is removed.
Thanks @netweb, I wasn't sure if I should include the package-lock.json
file or not.
It also adds the following improvements.
- Display the 404 template if the global post data or comment is not found in the edit template (
comments-edit.php
). - Include links to the note and note author in the description of the edit template.
- Add breadcrumb trail items to the reference and post type archive.
#6
@
7 years ago
Thanks @keesiemeijer, I'll leave the rest of the code review to @coffee2code and @drew who are more familiar with teh DevHub codebase
#7
@
7 years ago
Patch 3572.6.patch adds a new rule to the note feedback form.
Many users are using the note feedback form to ask (support) questions and are not really adding to the documentation.
That's why I added this new rule.
- Feedback is part of the documentation. Use this form to report errors or to add additional information to this note.
When editing a note a link to to the note you're replying to is added to the rule.
- Feedback is part of the documentation. Use this form to report errors or to add additional information to note 22 by admin.
A screenshot is following.
#8
@
7 years ago
Patch 3572.8.patch displays an error and a way back to the edit form if a comment is empty after editing.
Other improvements:
- Add extra checks (post_id, post_type) before updating a comment.
- Use
htmlspecialchars_decode()
for comment content when editing a top level comment.
Just to recap, this patch:
- Allows users to edit their own top level comments and child (feedback) comments
- Adds a new rewrite rule and theme template file for editing comments
- Adds comment rules (guidelines) to the feedback form
- Improves scrolling to notes (adjusting for the admin bar)
- Works with Javascript disabled
#9
@
7 years ago
With patch 3572.9.patch you're redirected to the edited comment after a comment is updated.
This matches what happens after a new comment is created.
#10
@
7 years ago
Patch 3572.10.patch removes the edit notice if a comment wasn't updated after editing. Comments are now updated on the init
hook with priority 20. This ensures the theme (or the WP Parser) have registered the parsed post types needed to check if a the current user can edit a comment.
Sorry for the many patches. This was a work in progress that (I think) is now stable for commit.
Add ability for user to edit their own user contibuted notes