#17906 closed enhancement (maybelater)
Refactor submit box code
Reported by: | scribu | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Administration | Keywords: | has-patch |
Focuses: | Cc: |
Description
The code for the post submit metabox is a mess. It should be cleaned up, so that changes such as #17028 can be done more easily.
Will post a patch shortly.
Attachments (2)
Change History (15)
#2
@
13 years ago
In your patch, the posts_status dropdown option value for future gets changed from future
to publish
.
(Some code standards whitespace missing in the first two green blocks too.)
#3
@
13 years ago
A very good catch. See 17906.2.diff.
I noticed a similar bug in the current code, where private posts get the status 'publish':
<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
#4
@
13 years ago
I noticed that too, but assumed that privately published or publicly published posts still had the same post_status (I was only checking your patch, not the wider code).
Thinking slightly wider (may be out of scope for this ticket), as the $status_labels are likely used elsewhere (Quick Edit for instance), could the array be wrapped in a function and placed somewhere suitable so all instances of post status labels could access it?
#5
@
13 years ago
Actually, I was thinking of moving them to their respective post status object label array.
#6
@
13 years ago
After grepping through the source code, these strings seem to be specific to the submit box. The only other place where the 'Privately Published' string appears, for example, is in wp-includes/script-loader.php.
#7
@
13 years ago
wp-admin/includes/class-wp-posts-list-table.php
includes similar strings for the Quick Edit - the question to ask might be why is there an inconsistent use of "Private" in one place and "Privately Published" in another, which makes code un-DRY and makes more work for translators.
#9
@
13 years ago
There's still a bug in my patch, related to setting a password for a post. It reverts to private.
#10
@
13 years ago
One way to simplify the logic would be to completely separate visibility from status.
So, you would have statuses, related to editorial flow:
- draft
- pending
- published
- scheduled
And visibility:
- public
- private
- password protected
Thus, you could have private drafts etc.
#11
in reply to:
↑ description
@
11 years ago
- Keywords 3.3-early removed
- Resolution set to maybelater
- Status changed from new to closed
Replying to scribu:
The code for the post submit metabox is a mess. It should be cleaned up, so that changes such as #17028 can be done more easily.
Will post a patch shortly.
I agree this is a mess but while there are logic improvements this is mostly refactoring for coding standards and readability and there has been no activity in 2 years. See: http://make.wordpress.org/core/2011/03/23/code-refactoring/
#12
@
11 years ago
I do like the gist of 17906.2.diff but this no longer applies cleanly and likely needs some other tweaks.
first pass