• Resolved Robert Dall

    (@rdall)


    I have set up a development site to auto update with the beta tester plugin.

    But as you might well imagine it sends out a lot of emails…

    I looked into the post Nacin wrote on the The definitive guide to disabling auto updates in WordPress 3.7

    And he wrote about how to:

    6. Manipulate whether notification emails are sent

    And I wanted to set something up so on my beta site so it continues to update daily but only email on a fail, but I am not quite sure how to set up the filter so it did just that?

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    I have not tried it, but this is the filter call:

    /* @param bool   $send        Whether to send the email. Default true.
     * @param string $type        The type of email to send.
     *                            Can be one of 'success', 'fail', 'critical'.
     * @param object $core_update The update offer that was attempted.
     * @param mixed  $result      The result for the core update. Can be WP_Error.
     */
    apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result );

    So, given that, what you really want is a function to turn off emails when type == success.

    function update_no_email_on_success($send, $type, $core_update, $result) {
      if ( $type == 'success' ) {
        $send = false;
      }
      return $send;
    }
    
    add_filter('auto_core_update_send_email', 'update_no_email_on_success', 10, 4);
    Thread Starter Robert Dall

    (@rdall)

    Hi Otto

    Thanks I will give it a try and see what happens…

    Thread Starter Robert Dall

    (@rdall)

    Hi Otto

    Your filter did block this email:

    Howdy! Your site at https://test.robertdall.com has been updated automatically to WordPress 3.8-alpha-26127-20131113.

    Which if I am correct is the email sent out when a point release site (eg. normal install) is updated.

    But I am still getting the

    WordPress site: https://test.robertdall.com/
    SUCCESS: WordPress was successfully updated to WordPress 3.8-alpha-26127-20131114

    Email which I believe only is sent out when your site is in beta. Without the filter I would be getting both emails.

    You have any idea how to block both?

    Thread Starter Robert Dall

    (@rdall)

    Hi Otto

    Nacin told me to add the automatic_updates_send_debug_email filter as well and so I copied your process again.

    and added it to the plugin file.

    See the gist here.

    Not getting an error so let’s hope I did this correctly…

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    No, that’s not quite right there because that filter takes a different type of argument list.

    The automatic_updates_send_debug_email filter doesn’t get information on success or failure, so the most you can do is to turn on or off the debug email globally. You can turn it off like so:

    add_filter('automatic_updates_send_debug_email','__return_false');

    Note that the debug email only happens when you’re running a development version. If you were using just stable, it wouldn’t send you that email anyway.

    Thread Starter Robert Dall

    (@rdall)

    Hi Otto

    I will give that a try…?I don’t mind the stable version email at all…?I just wanted a way to disable the daily duplicated email updates.

    Thanks for all your help in find a solution this to small issue

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Only email on fail of update when in alpha / beta’ is closed to new replies.