Ticket #2445 (closed defect (bug): fixed)

Opened 6 years ago

Last modified 5 years ago

comment_status and ping_status ignored on publish/first save

Reported by: Samael Owned by: markjaquith
Priority: high Milestone:
Component: Administration Version: 2.0.1
Severity: major Keywords: comments bg|has-patch bg|2nd-opinion bg|dev-feedback
Cc:

Description (last modified by markjaquith) (diff)

When writing a new entry the checkboxs "Allow Comments" and "Allow Pings" are being ignored on publish or first save. When you deactivate "Allow Comments" or "Allow Pings" and click on "Save and Continue Editing" the checkbox is checked again. If you click "Publish" and re-edit the post, the checkbox will be checked again. The checkbox only works when you update an entry but not when it's saved for first time or published without first saving.

Updated to include ping_status and for clarity - markjaquith

Attachments

txfx-empty-means-closed.php Download (421 bytes) - added by markjaquith 6 years ago.
Plugin for WP 2.0.1 to fix the issue
ping_comment_status_fix.diff Download (507 bytes) - added by markjaquith 6 years ago.

Change History

  • Status changed from new to assigned
  • Severity changed from normal to major
  • Priority changed from normal to high
  • Owner changed from anonymous to markjaquith
  • Milestone set to 2.1
  • Keywords bg|needs-patch added

Confirmed in 2.0.1 and latest SVN as of the time of this comment.

  • Description modified (diff)
  • Summary changed from comment_status ignored on first save to comment_status and ping_status ignored on publish/first save

Ditto for the ping setting

  • Description modified (diff)
  • Keywords bg|has-patch bg|2nd-opinion bg|dev-feedback added; bg|needs-patch removed

The code is currently checking if the field is empty and if so setting to get_settings('default_comment_status') or get_settings('default_ping_status')

Of course, if you uncheck the boxes, they will be empty, so they'll be set to the default status.

I think the default status should only be used to check or uncheck the boxes when you first load the Write screen. If you save/publish a post and the settings are empty, it should treat them as unchecked and make the setting 'closed'

My patch makes that change.

Plugin for WP 2.0.1 to fix the issue

The plugin I uploaded fixes the issue for people who are not comfortable applying patches.

comment:6   ryan6 years ago

This might break importers and xmlrpc which sometimes rely on wp_insert_post() setting the proper default status if nothing is passed in. I think we can accommodate everyone by distinguishing between not set and set but empty.

When comment_status or ping_status is unchecked, nothing is passed in. It doesn't even exist in the $_POST array. So we can't distinguish using "set but empty" because it never is.

How about distinguishing between import/XMLRPC and normal WP web interface? We could assume default for import/XMLRPC and assume "closed" for WP web interface.

comment:8   ryan6 years ago

edit_post() in admin-functions sets ping_status in $_POST to 'closed'. write_post() should do the same thing but it doesn't. The fix can be made there.

Victory. Someone else try the uploaded patch. Make sure that your default is comments/pings ON. Write, uncheck "allow comments" and "allow pings," publish, and re-edit the post to see if it stuck.

Works for me. Going in...

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [3547]) Honor comment_status and ping_status when writing a new post. Props Mark Jaquith. fixes #2445

Ah, good to see this fixed.  I reported this same issue back at the end of November, but mistakenly closed it for some reason (no clue as to why).

  • Resolution set to fixed

(In [3554]) Honor comment_status and ping_status when writing a new post. Props Mark Jaquith. fixes #2445

  • Milestone changed from 2.1 to 2.0.2
  • Milestone 2.0.2 deleted

Milestone 2.0.2 deleted

Note: See TracTickets for help on using tickets.