WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Only email on fail of update when in alpha / beta (7 posts)

  1. Robert Dall
    Member
    Posted 5 months ago #

    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

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 months ago #

    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);
  3. Robert Dall
    Member
    Posted 5 months ago #

    Hi Otto

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

  4. Robert Dall
    Member
    Posted 5 months ago #

    Hi Otto

    Your filter did block this email:

    Howdy! Your site at http://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: http://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?

  5. Robert Dall
    Member
    Posted 5 months ago #

    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…

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 months ago #

    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.

  7. Robert Dall
    Member
    Posted 5 months ago #

    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

Reply

You must log in to post.

About this Topic