Opened 11 years ago
Last modified 9 years ago
#2732 new defect (bug)
pending and draft replies cause menu_order issues
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 2.7 | Priority: | normal |
| Severity: | normal | Version: | trunk |
| Component: | Component - Replies | Keywords: | has-patch |
| Cc: |
Description
When a post is posted as pending or draft, the menu order is set to 0. When either of those is published, the menu_order is incorrect, usually a repeat of the menu_order of the next reply in the topic.
Drafts should probably go to the end and pending posts should go to the end, too? End = the last place in the menu order.
I just noticed this doing something else and haven't come across an issue with it but it could possibly cause problems with bbp_reply_url under quite frankly very rare conditions. Or perhaps the behaviour might be unexpected as the pending and draft replies pop up in the topic when they were initially written rather than at the end of it.
Attachments (2)
Change History (11)
#1
@
11 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 2.6
- Priority changed from low to normal
- Severity changed from minor to normal
- Version set to trunk
This ticket was mentioned in Slack in #bbpress by tharsheblows. View the logs.
11 years ago
#4
@
11 years ago
This updates the menu_order when approving pending replies. It only does replies with a menu_order == 0, so if a reply goes from publish -> pending -> publish for some reason, the menu_order stays as the original.
#6
@
11 years ago
The below post ID 183 is a normal approved reply in a topic, the second post ID 184 is by a different user using a keyword to trigger the moderation que (moderatedword), note even though the status is pending it is currently assigned the correct menu_order position 5.
| ID | post_author | post_date | post_date_gmt | post_content | post_title | post_excerpt | post_status | comment_status | ping_status | post_password | post_name | to_ping | pinged | post_modified | post_modified_gmt | post_content_filtered | post_parent | guid | menu_order | post_type | post_mime_type | comment_count |
| 183 | 1 | 2015-03-20 13:38:00 | 2015-03-20 13:38:00 | moderatedword blacklistword | publish | closed | open | 183 | 2015-03-20 13:38:00 | 2015-03-20 13:38:00 | 177 | http://src.wordpress-develop.dev/forums/reply/183/ | 4 | reply | 0 | |||||||
| 184 | 3 | 2015-03-20 13:39:20 | 0000-00-00 00:00:00 | moderatedword | pending | closed | open | 2015-03-20 13:39:20 | 0000-00-00 00:00:00 | 177 | http://src.wordpress-develop.dev/?post_type=reply&p=184 | 5 | reply | 0 |
Other notes as a sanity check whilst we go through this:
post_dateis the time the reply was createdpost_date_gmtis not assigned to thependingreplypost_nameis not assigned to thependingreplypost_modifiedis the time the reply was createdpost_modified_gmtis not assigned to thependingreply- GUID does not include the site rewrite slug, this can be ignored though as it uses the native WP type
Adding a new reply before approving the existing pending reply:
Everything looks good here except the menu_order of the new approved reply is 5 which is the same as the pending reply above.
| ID | post_author | post_date | post_date_gmt | post_content | post_title | post_excerpt | post_status | comment_status | ping_status | post_password | post_name | to_ping | pinged | post_modified | post_modified_gmt | post_content_filtered | post_parent | guid | menu_order | post_type | post_mime_type | comment_count |
| 185 | 1 | 2015-03-20 13:55:33 | 2015-03-20 13:55:33 | Reply before approve existing pending reply | publish | closed | open | 185 | 2015-03-20 13:55:33 | 2015-03-20 13:55:33 | 177 | http://src.wordpress-develop.dev/forums/reply/185/ | 5 | reply | 0 |
Approving reply 184 results in:
- All four post date fields are update to the time the
pendingreply was approved and the original post date/time is lost, we need to store the original post date/time and after approving the reply restore this date/time. - Post ID
186is a revision, we can disable this during the approve action but no big deal menu_orderof the originalpendingreply remains5which is correct, the follow up reply is also5thus when approving a pending reply all replies to a topic should be updated.
| ID | post_author | post_date | post_date_gmt | post_content | post_title | post_excerpt | post_status | comment_status | ping_status | post_password | post_name | to_ping | pinged | post_modified | post_modified_gmt | post_content_filtered | post_parent | guid | menu_order | post_type | post_mime_type | comment_count |
| 183 | 1 | 2015-03-20 13:38:00 | 2015-03-20 13:38:00 | moderatedword blacklistword | publish | closed | open | 183 | 2015-03-20 13:38:00 | 2015-03-20 13:38:00 | 177 | http://src.wordpress-develop.dev/forums/reply/183/ | 4 | reply | 0 | |||||||
| 184 | 3 | 2015-03-20 14:01:14 | 2015-03-20 14:01:14 | moderatedword | publish | closed | open | 184 | 2015-03-20 14:01:14 | 2015-03-20 14:01:14 | 177 | http://src.wordpress-develop.dev/?post_type=reply&p=184 | 5 | reply | 0 | |||||||
| 185 | 1 | 2015-03-20 13:55:33 | 2015-03-20 13:55:33 | Reply before approve existing pending reply | publish | closed | open | 185 | 2015-03-20 13:55:33 | 2015-03-20 13:55:33 | 177 | http://src.wordpress-develop.dev/forums/reply/185/ | 5 | reply | 0 | |||||||
| 186 | 1 | 2015-03-20 14:01:14 | 2015-03-20 14:01:14 | moderatedword | inherit | open | open | 184-revision-v1 | 2015-03-20 14:01:14 | 2015-03-20 14:01:14 | 184 | http://src.wordpress-develop.dev/184-revision-v1/ | 0 | revision | 0 |
#7
@
11 years ago
I think this GitHub commit by @iamskwerl is related
https://github.com/Skwerl/bbPress/commit/62827739410e9270dfdab4b1052ec656cda7f4fb
Ok, this gives all non-published replies a menu_order of zero rather than doubling up. I was also wrong about the menu_order affecting the order of replies listed. Those have order using the date, so a reply that was pending initially will get the date and time of approval as usual.