Make WordPress Core

Opened 20 years ago

Closed 20 years ago

Last modified 19 years ago

#2445 closed defect (bug) (fixed)

comment_status and ping_status ignored on publish/first save

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

Description (last modified by markjaquith)

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 (2)

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

Download all attachments as: .zip

Change History (17)

#1 @markjaquith
20 years ago

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

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

#2 @markjaquith
20 years ago

  • 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

#3 @markjaquith
20 years ago

  • Description modified (diff)

#4 @markjaquith
20 years ago

  • 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.

@markjaquith
20 years ago

Plugin for WP 2.0.1 to fix the issue

#5 @markjaquith
20 years ago

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

#6 @ryan
20 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.

#7 @markjaquith
20 years ago

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.

#8 @ryan
20 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.

#9 @markjaquith
20 years ago

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.

#10 @ryan
20 years ago

Works for me. Going in...

#11 @ryan
20 years ago

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

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

#12 @Viper007Bond
20 years ago

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).

#13 @ryan
20 years ago

  • Resolution set to fixed

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

#14 @ryan
20 years ago

  • Milestone changed from 2.1 to 2.0.2

#15 @(none)
19 years ago

  • Milestone 2.0.2 deleted

Milestone 2.0.2 deleted

Note: See TracTickets for help on using tickets.