Opened 14 years ago
Closed 14 years ago
#15629 closed defect (bug) (wontfix)
Only support registered post formats in XML-RPC
Reported by: | ericmann | Owned by: | ericmann |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | XML-RPC | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
Currently, the XML-RPC interface assumes a default post format when the post format field is omitted in a create or update request. As a result, some users with external tools (like Live Writer) are seeing "default" tagged on their new posts.
We should only add the default post format if post formats are enabled for the site. We should also limit the XML-RPC interface such that it only adds post formats explicitly supported by the site's theme.
Attachments (1)
Change History (11)
#2
in reply to:
↑ 1
@
14 years ago
Replying to nacin:
This logic can probably go directly into set_post_format.
Actually, that might be a more appropriate place. Then it would catch plug-ins trying to mark unsupported formats and not just external XML-RPC tools.
#3
@
14 years ago
"default" is going into the DB. We should put nothing in the DB for the default format.
#4
@
14 years ago
On limiting to valid post format types, the existing code checks with get_post_format_strings() to see if it is a valid type.
#7
@
14 years ago
- Keywords has-patch needs-testing added; needs-patch removed
My first thought was to check if the current theme supports the post format being passed in to set_post_format()
. This way, if a remote system tries to create a post with an unregistered post format, it won't add clutter to the database. To achieve this, I had to tweak current_theme_supports()
to add a check for post-formats
.
This should fix both the XML-RPC issue and any potential issues raised by other systems (i.e. plug-ins) trying to add unsupported post formats.
The patch is as yet untested ... but I wanted to make good on my promise to get a patch posted tonight :-)
#8
@
14 years ago
Nice!
It looks like that code works the same as the post-formats branch. We should be able to just add the extra case there.
also, we should optionally return false, in set_post_format, if the theme doesn't support it, as the action failed.
In fact, all of these functions should noop.
Mark, maybe we should move these functions into a new file, and require_if_theme_support()? Seems odd to use it for thumbnails if we're not going to use them here.
This logic can probably go directly into set_post_format.