WordPress.org

Ready to get started?Download WordPress

Forums

Revisionary
Email notifications not sent for new pages (only revisions) (3 posts)

  1. dorsetjon
    Member
    Posted 2 months ago #

    We've used Revisionary for 18 months over various releases and email notification have always been erratic. Now using Revisionary 1.1.12 & WP 3.9.1 and this issue persists. What is consistent is that notifications are not sent when a new page is created by a Revisor user but they are sent when a user edits an existing page.

    Having studied the code the cause of the issue appears to be in admin_rvy.php and is as follows:

    function act_impose_pending_rev() is called but the email is never sent because execution stops at this point (before the code to send emails):

    if ( empty($this->impose_pending_rev) ) {
    return;
    }

    $this->impose_pending_rev is empty and should be set in function flt_pendingrev_post_status().

    So what's happening in flt_pendingrev_post_status()?Eexecution in flt_pendingrev_post_status() is halted by the following code before impose_pending_rev is set:

    if ( empty($status_obj) || ( ! $status_obj->public && ! $status_obj->private && ( 'future' != $stored_post->post_status ) ) )
    return $status;

    This if statement's condition is being met because $status_obj is not empty and $status_obj->protected is true (i.e. public and private are both false).

    I might be wrong, but it appears that "protected" means a user must be logged in and have edit permissions on the post to view it. So it appears to be valid that our posts are "protected" when pending approval and this shouldn't prevent notifications being sent.

    Why does Revisionary prevent emails being sent when post is protected and could this code be changed to allow emails to be sent?

    https://wordpress.org/plugins/revisionary/

  2. dorsetjon
    Member
    Posted 2 months ago #

    Further to my last post, there are further conditions (beyond the one above that stops execution) that are not being satisfied in flt_pendingrev_post_status() such that $this->impose_pending_rev is not being populated and emails not sent. One or both of the following must be met:

    Condition One

    if ( ! empty( $_POST['rvy_save_as_pending_rev'] ) && ! empty($_POST['post_ID']) )

    Condition Two

    if ( $type_obj = get_post_type_object( $_POST['post_type'] ) )
    {
    if ( ! agp_user_can( $type_obj->cap->edit_post, $post_id, '', array( 'skip_revision_allowance' => true ) ) )

    For us, Condition One is never met whereas Condition Two is only met for published pages. Condition One is not being met because $_POST['rvy_save_as_pending_rev'] is always empty.

    I will continue working on this but there are no comments in the code so it is hard to work out what's going on. If anyone can shed any light on this then that would be great.

  3. dorsetjon
    Member
    Posted 2 months ago #

    OK, so it's Condition Two that is the issue, i.e.

    !agp_user_can( $type_obj->cap->edit_post, $post_id, '', array( 'skip_revision_allowance' => true ) )

    Now need to work out why when a post/page is first created agp_user_can() returns that the user can edit the post/page because that's what's stopping the notifications. Presumably this return code is wrong given that the post/page is still marked as needing approval?

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.