Plugin Directory

Changeset 3061369


Ignore:
Timestamp:
03/29/2024 10:39:25 PM (2 years ago)
Author:
ehops32
Message:

1.3.0

  • Gives an option to disable various email types like for theme/plugin auto updates
  • Gather email log data so we can alert you to any email errors your site is having.
Location:
sackson-web-data/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sackson-web-data/trunk/README.txt

    r3027196 r3061369  
    55Requires at least: 3.0.1
    66Tested up to: 6.0
    7 Stable tag: 1.2.9
     7Stable tag: 1.3.0
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    5050
    5151== Changelog ==
     52
     53= 1.3.0 =
     54* Gives an option to disable various email types like for plugin auto updates, theme auto updates, core auto updates
     55* Gather email log data so we can alert you to any email errors your site is having.
    5256
    5357= 1.2.9 =
  • sackson-web-data/trunk/includes/class-sacksonweb-data-helper.php

    r3012275 r3061369  
    152152        $this->getSiteCoreData();
    153153        $this->getFileSystemItems ();
     154        $this->getWPSMTPLogData();
    154155        $this->getSimpleHistoryLastLoginData();
    155156        $this->getUserData();
    156157        $this->getPluginUpdateData();
    157 
    158158    }
    159159   
     
    545545     * Get user log in data - wp_mail_smtp
    546546     */
    547     function getWPSMTPData( )
    548     {
    549         // // If WP SMTP isn't active don't return any data.
    550         // if ( isset($this->collected_data['active_plugins']) && !$this->isWPSMTPPluginActive()  )
    551         // {
    552         //     return;
    553         // }
    554 
    555         // global $wpdb;
    556 
    557         // $smtp_table = $wpdb->prefix . 'simple_history';
    558        
    559         // //SELECT * FROM `wp_kwyg9knqba_simple_history` ORDER BY `id` DESC
    560 
    561 
     547    function getWPSMTPLogData( )
     548    {
     549        // If WP SMTP isn't active don't return any data.
     550        if ( isset($this->collected_data['active_plugins']) && !$this->isWPSMTPPluginActive()  )
     551        {
     552            return;
     553        }
     554
     555        global $wpdb;
     556
     557        $smtp_table = $wpdb->prefix . 'wpmailsmtp_debug_events';
     558       
     559        $q = 'SELECT * FROM `' . $smtp_table . '` ORDER BY `created_at` DESC LIMIT 5;';
     560        $rows = $wpdb->get_results($q);
     561        foreach ($rows as $row)
     562        {
     563            $last_smtp_logs[] = array($row->content, $row->initiator);
     564        }
     565       
     566        $this->collected_data['wpsmtp_log_data'] = json_encode($last_smtp_logs);
    562567    }
    563568
  • sackson-web-data/trunk/includes/class-sacksonweb-data-settings.php

    r2802983 r3061369  
    4141
    4242    public function sacksonweb_premium_settings_create_admin_page() {
     43        // Sample sacksonweb_premium_settings_option_name  -  a:3:{s:7:"email_0";s:0:"";s:15:"refresh_every_0";s:1:"1";s:7:"allow_1";s:3:"Yes";}
    4344        $this->sacksonweb_premium_settings_options = get_option( 'sacksonweb_premium_settings_option_name' ); ?>
    4445
     
    120121
    121122        add_settings_field(
     123            'suppress_successful_email_updates', // id
     124            'Suppress Emails', // title
     125            array( $this, 'suppress_emails_list_field' ), // callback
     126            'sackson-web-premium-settings-admin', // page
     127            'sacksonweb_premium_settings_setting_section' // section
     128        );
     129        // Add Field for selecting countries for which you wanna ban ads
     130        //add_settings_field( 'aicp_country_list', __( 'Select the countries', 'aicp' ), 'country_list_field', 'aicp_settings', 'aicp_section' ); // id, title, display cb, page, section
     131
     132        // Register Settings
     133        // register_setting( 'aicp_settings', 'aicp_settings_options', array( $this, 'validate_options' ) );
     134   
     135
     136
     137        add_settings_field(
    122138            'email_0', // id
    123139            'Email', // title
     
    135151        );
    136152
     153
     154
    137155       
    138156    }
     
    151169        if ( isset( $input['allow_1'] ) ) {
    152170            $sanitary_values['allow_1'] = $input['allow_1'];
     171        }
     172
     173        if ( isset( $input['email_suppress_list'] ) ) {
     174            $sanitary_values['email_suppress_list'] = $input['email_suppress_list'];
    153175        }
    154176
     
    180202        <label for="allow_1-1"><input type="radio" name="sacksonweb_premium_settings_option_name[allow_1]" id="allow_1-1" value="No" <?php echo esc_attr($checked); ?>> No</label></fieldset> <?php
    181203    }
     204
     205    // now comes the section for checkbox
     206    public function suppress_emails_list_field() {
     207
     208        $value = array();   
     209
     210        if (isset($this->sacksonweb_premium_settings_options['email_suppress_list']) && ! empty($this->sacksonweb_premium_settings_options['email_suppress_list'])) {
     211            $value = $this->sacksonweb_premium_settings_options['email_suppress_list'];
     212        }
     213
     214        $checked = in_array('theme_plugin_update_success', $value) ? 'checked' : '' ;
     215        echo '<input type="checkbox" name="sacksonweb_premium_settings_option_name[email_suppress_list][]" value="theme_plugin_update_success"' . $checked . '/> Supress Successful Theme and Plugin Update Emails <br />';
     216
     217        $checked = in_array('theme_plugin_update_failed', $value) ? 'checked' : '' ;
     218        echo '<input type="checkbox" name="sacksonweb_premium_settings_option_name[email_suppress_list][]" value="theme_plugin_update_failed"' . $checked . '/> Supress Failed Theme and Plugin Update Emails (not recommended)<br />';
     219
     220    }
     221
     222
    182223
    183224}
  • sackson-web-data/trunk/includes/class-sacksonweb-data.php

    r3027196 r3061369  
    8787
    8888        // Disable WordPress Administration email verification prompt
    89         add_filter( 'admin_email_check_interval', '__return_false' );
    90 
     89        $this->disableAdminVerificationPrompts();
     90       
    9191        // Disable email notification for automatic plugin updates
    92         // I'm not sure if this disables failed plugin updates or not. Let's test it out!
    93         add_filter( 'auto_plugin_update_send_email', '__return_false' );
     92        add_filter( 'auto_plugin_theme_update_email', 'myplugin_auto_plugin_theme_update_email', 10, 4 );
    9493
    9594        // Hiding WordPress version:
     
    102101    }
    103102   
     103
     104    /**
     105     * method - myplugin_auto_plugin_theme_update_email
     106     * Description - too many emails about successful plugin udpates? If the SW setting for the site is set, then this will disable successful plugin update emails.
     107     */
     108    function myplugin_auto_plugin_theme_update_email( $email, $type, $successful_updates, $failed_updates ) {
     109       
     110        $sacksonweb_premium_settings_options = get_option( 'sacksonweb_premium_settings_option_name' );
     111        if (isset($sacksonweb_premium_settings_options['email_suppress_list']) && ! empty($sacksonweb_premium_settings_options['email_suppress_list'])) {
     112            $email_suppress_list = $sacksonweb_premium_settings_options['email_suppress_list'];
     113        }
     114
     115        // First let's check our plugin settings to see if this website even wants to to make any changes
     116        if ( in_array( ['theme_plugin_update_failed'], $email_suppress_list) )
     117        {
     118            if ( 'fail' === $type ) {
     119                // Change the email subject when updates failed
     120                $email['subject'] = __( 'ATTN: IT Department – SOME AUTO-UPDATES WENT WRONG!', 'my-plugin' );
     121               
     122                // Change the email recipient.
     123                $email['to'] = 'eric@homesnaps.com';
     124            }
     125            else {
     126                $email['to'] = 'auto_delete_email_rule@homesnaps.com';
     127            }
     128       
     129            return $email;
     130        }
     131    }
     132
     133
     134
     135
     136
     137    /**
     138     *
     139     */
     140    public function disableAdminVerificationPrompts ()
     141    {
     142        add_filter( 'admin_email_check_interval', '__return_false' );
     143    }
     144
    104145    /**
    105146     * Load the required dependencies for this plugin.
  • sackson-web-data/trunk/sacksonweb-data.php

    r3027196 r3061369  
    1010 *
    1111 * @link              http://data.sacksonweb.com/author
    12  * @since             1.2.9
     12 * @since             1.3.0
    1313 * @package           Sacksonweb_Data
    1414 *
     
    1717 * Plugin URI:        http://data.sacksonweb.com
    1818 * Description:       A tool to monitor security issues, performance issues, and Wordpress settings that should be changed.
    19  * Version:           1.2.9
     19 * Version:           1.3.0
    2020 * Author:            Eric Thornton
    2121 * Author URI:        http://data.sacksonweb.com/author
     
    3535 *
    3636 */
    37 define( 'SACKSONWEB_DATA_VERSION', '1.2.9' );
     37define( 'SACKSONWEB_DATA_VERSION', '1.3.0' );
    3838
    3939/**
Note: See TracChangeset for help on using the changeset viewer.