Forum Replies Created

Viewing 15 replies - 1 through 15 (of 156 total)
  • Thread Starter ronr1999

    (@ronr1999)

    Awesome! That fixed these two problems. (ignore previous error comment – all’s good)

    • This reply was modified 3 months ago by ronr1999.
    Thread Starter ronr1999

    (@ronr1999)

    This is awesome, thanks for the update. I’ll check it out.

    Thread Starter ronr1999

    (@ronr1999)

    With my latest update, with outgoing emails, I’m feeling that it’s like a client’s website heartbeat. I manage 32 websites and these emails give me a sense of the overall pulse of these sites. Might be nice to have more details in the emails, like plugin updates, page/post updates, etc. I’ll have to look more closely at the code.

    Thread Starter ronr1999

    (@ronr1999)

    I’ve test everything that I can think of and it’s working. The key is that this works when a plugin is updated – especially Elementor.

    Again, thanks for all your help. I know that this will benefit a ton of folks – Elementor now has over 5 million plugin downloads. Yikes!

    Ok, here’s my latest. As a test, I’m writing to the error_log and sending myself an email. Those are working.

    /**
     * Clear the caches!
     */
    function ccfm_clear_cache_for_all() {
    	
        global $wp_fastest_cache, $kinsta_cache, $admin, $ccfm_source;
    
        if ( empty( $ccfm_source ) ) {
            $ccfm_source = '';
        }
    
        do_action( 'ccfm_clear_cache_for_me_before', $ccfm_source );
    
    	// Set the timezone to Pacific Standard Time (PST)
    	date_default_timezone_set('America/Los_Angeles');
    
    	// Check if Elementor is loaded
    	if (did_action('elementor/loaded')) {
    		// Automatically purge and regenerate the Elementor CSS cache
    		\Elementor\Plugin::instance()->files_manager->clear_cache();
    		$plugin_slugs[] = 'elementor';
    
    		// Log message
    		$timestamp = date("d-M-Y H:i:s T");
    		$log_message = "[{$timestamp}] Elementor Clear Cache has Run!";
    		error_log($log_message . PHP_EOL, 3, "/home/tfcahost/public_html/cache/error_log");
    
    		// Send email notification
    		$to = "me@gmail.com"; // recipient's email address
    		$subject = "Elementor Cache Cleared";
    		$message = "Elementor cache has been cleared at {$timestamp} PST.";
    		$headers = "From: an@examaple.com"; // Replace with the sender's email address
    
    		// Check if the email is sent successfully
    		if (mail($to, $subject, $message, $headers)) {
    			error_log("Email notification sent successfully." . PHP_EOL, 3, "/home/tfcahost/public_html/cache/error_log");
    		} else {
    			error_log("Failed to send email notification." . PHP_EOL, 3, "/home/tfcahost/public_html/cache/error_log");
    		}
    	}
    	
    Thread Starter ronr1999

    (@ronr1999)

    I thought of another enhancement that would be great. How about a log of when this is activated. I know that manually clicking on “Clear Cache for Me” gives the Success banner, but when it’s running in the background, it’s an unknown if it’s working or not.

    Thread Starter ronr1999

    (@ronr1999)

    Yes, it’s working fine at the end of: ccfm_clear_cache_for_all 

    Seems like winner!

    Thread Starter ronr1999

    (@ronr1999)

    I found an easier way to test. I go into file manager and delete the css files here: /wp-content/uploads/elementor/css

    This simulates what the Elementor community has been seeing for the past couple of years. This seems to happen when Elementor releases a new version. The web pages are missing its css so render is messed up.

    I tried your above edits but doesn’t seem to work when css files are missing. My original fix – adding to: clear-cache-for-widgets.php > ccfm_clear_cache_for_all is working fine. Elementor Regenerate needs to run before clearing cache. Or am I confused and your above code should also be installed… ?

    • This reply was modified 3 months, 2 weeks ago by ronr1999.
    Thread Starter ronr1999

    (@ronr1999)

    If you have a test site, I’m happy to install a copy of Elementor Pro.

    Thread Starter ronr1999

    (@ronr1999)

    Thanks for the response. I moved it to the clear-cache-for-widgets.php page and it’s working. It needs to clear the Elementor css files and then clear caching.

    function ccfm_clear_cache_for_all() {
    	
    	// Check if Elementor is loaded
        if ( did_action( 'elementor/loaded' ) ) {
            // Automatically purge and regenerate the Elementor CSS cache
            \Elementor\Plugin::instance()->files_manager->clear_cache();
            $plugin_slugs[] = 'elementor';
        }	
    
        global $wp_fastest_cache, $kinsta_cache, $admin, $ccfm_source;
    
        if ( empty( $ccfm_source ) ) {
            $ccfm_source = '';
        }

    When there is an Elementor plugin update it does a Regenerate but caching has not cleared. Regenerate removes all of the Elementor CSS files (wp-content/uploads/elementor/css) and on first page load it regenerates the files. If there is caching active, then the page will not recognize the new css files, especially if you’re doing css minification. So cache has to be cleared every time Elementor is updated.

    It just occurred to me, is your code also clearing minification? I’ve used WP-Optimize with minification but am now turning that off and moving to WP Super Cache.

    Thanks again, it would be awesome to have the incorporate in a new release of the plugin. I know the Elementor community would love you for it!

    Thread Starter ronr1999

    (@ronr1999)

    I see a problem. This Elementor Clear Cache needs to run BEFORE clearing any page caching plugin.

    Thread Starter ronr1999

    (@ronr1999)

    Actually it was working but just not adding to error_log file.

    Thread Starter ronr1999

    (@ronr1999)

    Looks like this addition to caching-plugins.php file will work:

    
    /**
     * Return an array of plugin slugs that exist on this install.
     * If $clear_cache is true or not set, run functions.
     */
    function ccfm_clear_addtional_cache( $clear_cache = true ) {
        $plugin_slugs = [];
    
        if ( class_exists( 'PremiumAddons\Admin\Includes\Admin_Helper' ) &&
             method_exists(PremiumAddons\Admin\Includes\Admin_Helper::class, 'get_instance') && 
             method_exists(PremiumAddons\Admin\Includes\Admin_Helper::class, 'delete_assets_options') ) {
                $plugin_slugs[] = 'premium-addons-for-elementor';
                if ( $clear_cache ) {
                    $admin_helper = PremiumAddons\Admin\Includes\Admin_Helper::get_instance();
                    $admin_helper->delete_assets_options();
                }
        }
    	
        // Check if Elementor is loaded
        if ( did_action( 'elementor/loaded' ) ) {
    	error_log("Elementor Clear Cache has Run!");
            // Automatically purge and regenerate the Elementor CSS cache
            \Elementor\Plugin::instance()->files_manager->clear_cache();
            $plugin_slugs[] = 'elementor';
        }	
    
        return $plugin_slugs; 
    }

    Thread Starter ronr1999

    (@ronr1999)

    Solved… sort of. I found that if I turn on define( ‘WP_DEBUG_LOG’, true ) then I get these error_log entries sent to ( wp-content/debug.log ). I can use this but why weren’t they going to the error_log file?

    Thread Starter ronr1999

    (@ronr1999)

    Here’s the (edited) session transcript using SENDINBLUE:

    Session Transcript https://smtp-relay.sendinblue.com:587 Code: 400, Message: Bad Request, Body: {“code”:”invalid_parameter”,”message”:”Unsupported file format: vcf”} –Raw message follows– Array ( [sender] => Array ( [name] => xxxxxxxxxxxxxxxxxxxxxx ) [to] => Array ( [0] => Array ( [email] => xxxxxxxxxxxxx ) ) [subject] => A Broker has been created or updated – VCARD attached [textContent] => Attached is the new or updated Vcard for xxxxxxxxx [headers] => Array ( [X-Mailer] => Postman SMTP 2.5.3 for WordPress (https://wordpress.org/plugins/post-smtp/) [message-id] => fdb636343b89c6fc7a1e323dad9b838b@aladdinbakers.com ) [attachment] => Array ( [0] => Array ( [name] => xxxxxxxxxx.vcf [content] => QkVHSU46VkNBUkQKVkVSU0lPTjozLjAK… == ) ) )

    Diagnostic test report:

    Mailer: postsmtp
    HostName: aladdinbakers.com
    cURL Version: 7.87.0
    OpenSSL Version: OpenSSL/1.1.1p
    OS: Linux az1-ss101.a2hosting.com 4.18.0-425.3.1.lve.3.el8.x86_64 #1 SMP Sat Dec 31 17:09:26 EST 2022 x86_64
    PHP: Linux 8.1.18 C.UTF-8
    PHP Dependencies: iconv=Yes, spl_autoload=Yes, openssl=Yes, sockets=Yes, allow_url_fopen=Yes, mcrypt=No, zlib_encode=Yes
    WordPress: 6.2.2 en_US UTF-8
    WordPress Theme: The Food Connector – Hello Elementor Child
    WordPress Plugins: Code Snippets Pro, Post SMTP, Admin Columns Pro – Advanced Custom Fields (ACF), Admin Columns Pro – WooCommerce, Admin Columns Pro, Admin Menu Editor Pro, Advanced Custom Fields PRO, AnyWhere Elementor Pro (Premium), Activity Log, Better Search Replace, Check & Log Email, Custom Post Type UI, Yoast Duplicate Post, Dynamic Visibility for Elementor, Elementor Pro, Elementor, Enable Media Replace, EWWW Image Optimizer, Formidable Forms Pro, Formidable Registration, Formidable WooCommerce, Formidable Forms, GTranslate, Headers Security Advanced & HSTS WP, Members, LoginWP (Formerly Peter’s Login Redirect), WooCommerce Shipment Tracking Pro – EDITED, Product Visibility by User Role for WooCommerce Pro, Really Simple Under Construction Page, Easy Updates Manager, The Food Connector – REMOVE QUOTE SELECTIONS, WooCommerce Product Table PRO, UpdraftPlus – Backup/Restore, User Menus, Checkout Field Editor for WooCommerce, WooCommerce, Wordfence Security, WP-Optimize – Clean, Compress, Cache, YayMail Pro – WooCommerce Email Customizer
    WordPress wp_mail Owner: /home/aladdinb/public_html/wp-content/plugins/post-smtp/Postman/PostmanWpMailBinder.php
    WordPress wp_mail Filter(s): wp_staticize_emoji_for_email, PostsmtpMailer->get_mail_args, CheckEmail\Core\Check_Email_Logger->log_email, CheckEmail\Core\Check_Email_From_Handler->override_values
    WordPress wp_mail_from Filter(s): wordfence::fixWPMailFromAddress, CheckEmail\Core\Check_Email_From_Handler->set_wp_mail_from
    WordPress wp_mail_from_name Filter(s): CheckEmail\Core\Check_Email_From_Handler->set_wp_mail_from_name
    Postman: 2.5.3
    Postman Sender Domain (Envelope|Message): aladdinbakersinc.com | aladdinbakers.com
    Postman Prevent Message Sender Override (Email|Name): Yes | Yes
    Postman Active Transport: Sendinblue (https://smtp-relay.sendinblue.com:587)
    Postman Active Transport Status (Ready|Connected): Yes | Yes
    Postman Deliveries (Success|Fail): 371 | 28

    Thread Starter ronr1999

    (@ronr1999)

    Looks like I’ve solved this issue and there appears to be a bug. We’re using WP-Optimize caching and turning on CSS Minification breaks Depicter’s font-family setting.

Viewing 15 replies - 1 through 15 (of 156 total)