WordPress.org

Support

Support » Plugins and Hacks » Edit Flow » [Resolved] [Plugin: Edit Flow] some transition_post_status action?

[Resolved] [Plugin: Edit Flow] some transition_post_status action?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Daniel Bachhuber

    @danielbachhuber

    Hand Built

    Which information are you wanting to monitor?

    new_status, old_status, $post should be OK.

    I have just found, that you got filter ef_notification_status_change what is probably what i am looking for, the problem is, that it seems do not work, as there is still “inherit” / “new” statuses, when i use it, not the custom ones i defined in ef statuses

    aaah I see the problem – it cannot work – you are using standard hook add_action( ‘transition_post_status’, array( $this, ‘notification_status_change’ ), 10, 3 );

    but this hook does not work because builtin status functionality is crippled (https://core.trac.wordpress.org/ticket/12706)

    so this example http://editflow.org/extend/auto-subscribe-user-groups-for-notifications/ could never work, because your function never recieves proper $new_status and $old_status, but only that stupid default ones with “new” and “inherit”

    Plugin Author Daniel Bachhuber

    @danielbachhuber

    Hand Built

    You’re correct — transition_post_status fires twice but the Edit Flow code only pays attention to once of those times.

    The example works because it’s only ever looking at $new_status.

    ufff, it took me some time but i finaly found a solution so you could repair it – fyi repaired action (btw if you would implement it, then do not put it to that notification module, otherwise it will not work if someone got it turned off, it should be imo universal code)

    function transition_post_status($new_status, $old_status, $post) {

    $post = (‘inherit’ == $new_status) ? get_post($post->post_parent) : $post;
    global $post_status;
    if (!empty($post_status)) {
    $old_status = $post_status;
    $new_status = $post->post_status;
    } else {
    $post_status = $post->post_status;
    return;
    }

    if ($old_status == $new_status) return; // do nothing if no status change

    // now do something with the old and new statuses
    print_r ($old_status);
    print_r ($new_status);
    }

    Plugin Author Daniel Bachhuber

    @danielbachhuber

    Hand Built

    Happy to look at a pull request if you want to create one.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] [Plugin: Edit Flow] some transition_post_status action?’ is closed to new replies.
Skip to toolbar