Plugin Directory

Changeset 2370971


Ignore:
Timestamp:
08/28/2020 10:10:24 AM (6 years ago)
Author:
simshaun
Message:

Support WordPress 5.5.1 and allow mixed/failure notifications through

Location:
disable-plugin-autoupdate-emails/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • disable-plugin-autoupdate-emails/trunk/disable-plugin-autoupdate-emails.php

    r2363302 r2370971  
    44 * Plugin Name: Disable Plugin Autoupdate Emails
    55 * Description: Getting too many "plugin updated" or "theme updated" emails since WordPress 5.5? This turns them off.
    6  * Version: 1.0.0
     6 *   Note: 1.1.0 supports WordPress 5.5.1, allowing mixed/failed update emails to continue sending.
     7 * Version: 1.1.0
    78 * Author: Shaun Simmons
    89 * Author URI: https://github.com/simshaun
     
    1415}
    1516
    16 add_filter( 'auto_plugin_update_send_email', 'faf_disable_auto_update_email' );
    17 add_filter( 'auto_theme_update_send_email', 'faf_disable_auto_update_email' );
     17function faf_maybe_allow_auto_update_email( $true, $update_results = null ) {
     18    if ( is_array( $update_results ) ) {
     19        foreach ( $update_results as $update_result ) {
     20            if ( true !== $update_result->result ) {
     21                return $true;
     22            }
     23        }
     24    }
     25
     26    return false;
     27}
     28
     29// WordPress 5.5.0 — Blanket disable regardless of success/failure.
     30add_filter( 'auto_plugin_update_send_email', 'faf_disable_auto_update_email', 10, 1 );
     31add_filter( 'auto_theme_update_send_email', 'faf_disable_auto_update_email', 10, 1 );
     32
     33// WordPress 5.5.1 — Disable if there were no failures.
     34// @see https://core.trac.wordpress.org/changeset/48889
     35add_filter( 'auto_plugin_update_send_email', 'faf_maybe_allow_auto_update_email', 10, 2 );
     36add_filter( 'auto_theme_update_send_email', 'faf_maybe_allow_auto_update_email', 10, 2 );
  • disable-plugin-autoupdate-emails/trunk/readme.txt

    r2363302 r2370971  
    33Tags: updates, autoupdates, disable autoupdate email
    44Requires at least: 5.5
    5 Tested up to: 5.5
    6 Stable tag: 5.5
     5Tested up to: 5.5.1
     6Stable tag: 5.5.1
    77Requires PHP: 5.3
    88License: GPLv2
     
    1414
    1515There's not much to this plugin. It's a couple barebones filters that turn off the plugin and theme autoupdate emails.
     16On WordPress 5.5.0, the update emails are turned off regardless of whether or not the updates failed.
     17Since WordPress 5.5.1, emails indicating update failures are allowed to send.
    1618
    1719== Changelog ==
    1820
     21= 1.1 =
     22* Allow mixed/failure emails to get through (WordPress 5.5.1+)
     23
    1924= 1.0 =
    2025* Initial release
Note: See TracChangeset for help on using the changeset viewer.