• Resolved Papoum

    (@papoum)


    Hi,

    It seems that there is a problem with Plugin Organizer and scheduled posts.

    When a scheduled post is published, “transition_post_status” hook is fired and your function “update_post_status” updates the post status in “po_plugins” table.
    But it does not update “permalink”, “permalink_hash” (and “permalink_hash_args” ?) which are modified when the post status changes from future to published.
    Then, as “permalink_hash” is not up to date, the post is not found and plugin exclusions are not applied.

    On the opposite, when we change manually the post status on the post meta box, everything is fine.

    Here is what I did to fix/hack this on my functions.php file.
    There surely might be better solutions but it seems to work…

    global $PluginOrganizer;
    if ($PluginOrganizer) {
    remove_filter( ‘transition_post_status’, array($PluginOrganizer, ‘update_post_status’) );
    function my_update_post_status($newStatus, $oldStatus, $post) {
    global $wpdb;
    $permalink = get_permalink($post);
    $permalink = preg_replace(‘/^.{1,5}:\/\//’, ”, $permalink);
    $permalinkNoArgs = preg_replace(‘/\?.*$/’, ”, $permalink);
    $wpdb->update($wpdb->prefix.”po_plugins”, array(“status”=>$newStatus,”permalink”=>$permalink, “permalink_hash”=>md5($permalinkNoArgs), “permalink_hash_args”=>md5($permalink)), array(“post_id”=>$post->ID));
    }
    add_filter(‘transition_post_status’, ‘my_update_post_status’, 10, 3);
    }

    It would be great if you could fix this directly in the plugin.

    Thanks.

    • This topic was modified 8 years, 6 months ago by Papoum.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jeff Sterup

    (@foomagoo)

    I’ve got a fix for this. It has been tested. I have another fix to release. Should be in a few hours.

    Thread Starter Papoum

    (@papoum)

    Great !

    Thanks.

    Plugin Author Jeff Sterup

    (@foomagoo)

    Version 6.0.11 should fix this problem.

    Thread Starter Papoum

    (@papoum)

    Problem solved !
    Thank you.

    Thread Starter Papoum

    (@papoum)

    Hi,

    The problem (not exactly the same problem but the same result) is back…
    When a scheduled post is published, po_plugins table is not updated.
    It seems that it is because of the adding of “is_admin()” condition in plugin-organizer.php (condition added in version 8.0).
    Is there a way to fix/hack this problem ?

    Thanks.

    Plugin Author Jeff Sterup

    (@foomagoo)

    For now you can just remove the if statement in plugin-organizer.php. I’ll take it out on the next release. Was intended to increase performance on the front end. I didn’t see that it caused issues with scheduled posts.

    Thread Starter Papoum

    (@papoum)

    Thank you, I will do that.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Issue with scheduled posts’ is closed to new replies.