[wp-hackers] Getting post_author to update with an autosave.

Mark Slade markandrewslade at gmail.com
Tue Nov 17 19:56:35 UTC 2009


Otto - thanks for the link.  I thought I was thorough in my search for
existing discussions on the topic but apparently was not :)

Mark


On Tue, 2009-11-17 at 13:46 -0600, Otto wrote:
> Looks like that was fixed here: http://core.trac.wordpress.org/ticket/10004
> 
> Fix will be in 2.9.
> 
> -Otto
> Sent from Memphis, TN, United States
> 
> 
> On Tue, Nov 17, 2009 at 10:56 AM, Mark Slade <markandrewslade at gmail.com> wrote:
> > Hello,
> >
> > I am trying to resolve an issue in my WPMU 2.8 installation causing a
> > page's original author to be carried over when it is autosaved by a
> > different author.
> >
> > I have hooked into edit_page_form and am using it to spit out a hidden
> > input named "post_author_override" with a value of the current user's
> > ID.  In an autosave this is translated to "post_author" and survives all
> > the way to wp_create_post_autosave(), defined in
> > wp-admin/includes/post.php.
> >
> > At this point _wp_post_revision_fields() is called, defined in
> > wp-includes/post.php, which removes the post_author field because it is
> > protected.  I can hook into the '_wp_post_revision_fields' filter and
> > add it, but it's hard-coded to be removed so this does me no good.
> >
> > As a result, the autosave is created/updated without post_author being
> > changed, and autosaves are always attributed to the original author and
> > not the actual author.
> >
> > I can fix this by directly editing _wp_post_revision_fields so that
> > post_author is not in the array of protected keys, but am concerned that
> > it was put there for a reason and this will cause something to break.
> >
> > Can anyone lend some insight?  Is it by design that autosaves keep the
> > original author, and not the actual author?
> >
> > Thank you,
> > Mark
> >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list