Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#18812 closed defect (bug) (fixed)

XML-RPC newPost need more dashboard-like behavior for publishing posts

Reported by: koke's profile koke Owned by: josephscott's profile josephscott
Milestone: 3.3 Priority: normal
Severity: normal Version:
Component: XML-RPC Keywords: has-patch mobile
Focuses: Cc:

Description

Right now, metaWeblog.newPost calls wp_insert_post before:

  • Attaching media uploads
  • Set/unset sticky
  • Set custom fields
  • Set post formats

This is probably done since all those actions need the post ID, but it can break some plugins that rely on the publish_post action hook since the post is not complete at that point.

The idea is to make it behave more like wp-admin:

  • Save the post as 'auto-draft'
  • Attach uploads, set custom fields, ...
  • Update with proper status

Attachments (4)

wp-18812.diff (1.1 KB) - added by koke 13 years ago.
Patch to set 'auto-draft' on metaWeblog.newPost until the post is complete
18812.diff (1.6 KB) - added by nacin 13 years ago.
rpc.diff (1.5 KB) - added by josephscott 13 years ago.
18812.2.diff (1.6 KB) - added by josephscott 13 years ago.

Download all attachments as: .zip

Change History (15)

@koke
13 years ago

Patch to set 'auto-draft' on metaWeblog.newPost until the post is complete

#1 @daniloercoli
13 years ago

  • Cc ercoli@… added

#2 @nacin
13 years ago

It'd be nice to do get_default_post_to_edit() then do a single wp_insert_post at the end.

@nacin
13 years ago

#3 follow-up: @nacin
13 years ago

Untested patch.

#4 follow-up: @josephscott
13 years ago

Is there a basic test case plugin that we can use to test the problem and potential solutions?

#5 in reply to: ↑ 4 @koke
13 years ago

Replying to josephscott:

Is there a basic test case plugin that we can use to test the problem and potential solutions?

The case I know is wordpress.com publicize, when publishing posts with images, the post in facebook doesn't have any of the images.
I guess any other facebook auto-publish plugin would have the same issue

#6 in reply to: ↑ 3 @josephscott
13 years ago

Replying to nacin:

Untested patch.

I tried this patch and it generated two of these PHP issues:

Warning: addslashes() expects parameter 1 to be string, object given in wp-includes/wp-db.php on line 783

I'm going to try out the orginal wp-18812.diff and see what happens there.

@josephscott
13 years ago

#7 @josephscott
13 years ago

Updated patch that I've tested using the Publicize feature on WPCOM and it appears to address the problem mentioned in the ticket. I'm soliciting a few more tests before giving this a full green light to commit to -trunk.

That said, this change is relatively small and looks like it shouldn't cause problems for other clients.

@josephscott
13 years ago

#8 @josephscott
13 years ago

After chatting with nacin about this, he found what was triggering the error with his patch. I've uploaded an updated version of his ( 18812.2.diff ).

Initial testing looks good.

#9 @josephscott
13 years ago

I talked with koke and he was good with this patch. At this point I think it ready to commit.

#10 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.3

#11 @josephscott
13 years ago

  • Owner set to josephscott
  • Resolution set to fixed
  • Status changed from new to closed

In [18933]:

Follow the pattern of wp-admin a bit more for metaWeblog.newPost by using get_default_post_to_edit() to generate a post ID before the post is actually published.

Fixes #18812
Props koke, nacin

Note: See TracTickets for help on using tickets.