Feature request – Original post status after edit

This topic contains 6 reply and 3 voices, and was last updated by bazelski 10 years, 10 months ago
Viewing 6 Posts - 1 through 6 (of 6 total)
Author Posts
June 6, 2013 at 5:17 am 4604
bazelski Hey, I need to have the ability to give my users the power to edit 'pending' and 'published' posts without changing the original status, so if a user edits a 'pending' post it'll stay as 'pending' after the edit, if you can make it happen as a base feature and not as a personal 'quick fix' I would be extremely happy. Keep up the good work!
June 6, 2013 at 7:01 am 4605
Tareq Hasan Tareq Hasan

So how should I deal with the edit post status settings (available in the form settings)?

June 6, 2013 at 10:33 am 4610
RMAndres RMAndres

I made it by creating an hidden input in the form with the name of ‘wp_post_status’ and the value is a variable that gets the current post status, I then just have to equal the $postarr[‘post_status’] to the $_POST [‘wpuf_post_status’], rendering, with this personal fix, the form edit setting option for post status obsolete.

A more open solution would be making another form setting option that would always get the current post status, maybe in a similar way as I did, but unfortunately I don’t have the time for that now.

best regards.

June 6, 2013 at 5:39 pm 4622
Tareq Hasan Tareq Hasan

If you want to set pending post status to pending after edit, you can do that by setting the edit post status to pending. If you are overriding it, the post edit status setting has no value.

June 6, 2013 at 7:25 pm 4626
RMAndres RMAndres

You don’t seem to have understood my words, sorry but english is not my main language.

What I did was:

Author writes post – defaults to post status ‘pending’;
Author edits post – post status stays as ‘pending’;
Editor sees post and publishes it – post status changes to ‘publish’;
Author edits post – post status stays as ‘publish’;

June 7, 2013 at 6:46 pm 4666
Tareq Hasan Tareq Hasan

Ok, now I understand your requirements fine. For your purpose, the outline you gave is fine. But what if I wanted to be the new post status to pending and edited post status to publish. I agree that there should be some changes needed, like user shouldn’t be able to edit posts while it’s in pending mode.

June 16, 2013 at 7:13 am 4922
bazelski bazelski

Exactly what I need

Author writes post – defaults to post status ‘pending’;
Author edits post – post status stays as ‘pending’;
Editor sees post and publishes it – post status changes to ‘publish’;
Author edits post – post status stays as ‘publish’;

Why I can’t use this conditional ?


function wpuf_editor_post_status( $postarr ) {
 
    if ($postarr['post_status'] == 'publish') {
        $postarr['post_status'] = 'publish';
    }
 
    return $postarr;
}
 
add_filter( 'wpuf_update_post_args', 'wpuf_editor_post_status' );

My post staus is set to pending after edit. This works good without this conditional statement if ($postarr['post_status'] == 'publish') {

Viewing 6 Posts - 1 through 6 (of 6 total)