Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter jdwf0658

    (@jdwf0658)

    Also wondering for the use case of custom forms that I made without using a plugin. I try to keep from the bloat as I dont need 100 different features for every little thing.

    I haven’t even check over the plugins code yet to see if theres any hooks/ filters i can take advantage of, figured it would be faster and easier to get directly from the plugins developer! Thank you!

    Thread Starter jdwf0658

    (@jdwf0658)

    Hey @prasidhda

    That sounds great! Thanks for the update, I’ve actually left a review about two weeks ago when I was replacing my security suite and discovered your plugin.

    Cheers!

    Don’t mean to grave dig. But I noticed with setting woocommerce>settings>products>downloadable products>Grant access to downloadable products after payment : [checked]
    It will send license keys while processing. Assuming your license keys are attached to downloadable products.

    I too have noticed that the cancel unpaid orders no longer runs. I have stock management enabled as well as a timer of 60 minutes. Checking my action scheduler I don’t even see it getting schedule anymore. I have WP Cron set to run every 30 minutes which runs the scheduler just fine.
    Can possibly just create our own action to handle this? Here is my work-around I’m thinking about doing.

    
    add_action('jd_cancel_unpaid_orders', 'jd_cancel_unpaid_orders_handler');
    function jd_cancel_unpaid_orders_handler() {
        wc_cancel_unpaid_orders();
    }
    

    Then using the WP CLI
    #change user to your path, sets up to check hourly.

    
    cd /home/user/public_html; wp cron event schedule jd_cancel_unpaid_orders now hourly
    

    NOTE: it checks the duration limit within the function wc_cancel_unpaid_orders() so having it run hourly should be fine.
    https://woocommerce.wp-a2z.org/oik_api/wc_cancel_unpaid_orders/

    • This reply was modified 4 years, 7 months ago by jdwf0658.
    • This reply was modified 4 years, 7 months ago by jdwf0658. Reason: Added Source
    Thread Starter jdwf0658

    (@jdwf0658)

    Yea, manually through AIOWPS resulted in same errors. it creates the file, and fills a portion before it reaches a memory limit. I’m not sure what the difference is. I don’t mind setting it up through cron, I have it checking for file changes and cleaning up transients still.

    Thanks!

    Thread Starter jdwf0658

    (@jdwf0658)

    Okay final tests, it runs out of memory while doing the wp_options table.
    these are the last lines it wrote (Note: my wp_options table is only 1743 total) size significantly smaller.

    
    [2020-04-01 21:15:07] - FAILURE : Writing table row: 3434909 in _transient_timeout_aiowps_captcha_string_info_9xrpb3y990
    [2020-04-01 21:15:07] - FAILURE : Writing table row: 3434910 in _transient_aiowps_captcha_string_info_9xrpb3y990
    [2020-04-01 21:15:07] - FAILURE : Writing table row: 3434911 in _transient_timeout_aiowps_captcha_string_info_a6c2be76ou
    [2020-04-01 21:15:07] - FAILURE : Writing table row: 3434912 in _transient_aiowps_captcha_string_info_a6c2be76ou
    

    I wanted to see if I could backup my site at all, which I ran the WP CLI

    
    wp db export ../my_wordpress_db.sql 
    

    which it exported my database properly.
    Going to turn off automatic backup’s through AIOWPS and schedule backups with WP CLI and Cron.

    • This reply was modified 4 years, 8 months ago by jdwf0658.
    Thread Starter jdwf0658

    (@jdwf0658)

    After further investigation its due to my wp_options table being too large.
    Working on cleaning this up, then it should perform as expected.
    After cleaning wp_options to only 300,000 bytes (bad mailer plugin that was deleted long ago made it almost 1,000,000 bytes). and my php limit set to 512M, you’d think it’d work?

    • This reply was modified 4 years, 8 months ago by jdwf0658.
    Thread Starter jdwf0658

    (@jdwf0658)

    Also if this helps the log files contain
    cron-log

    
    [2020-04-01 02:30:05] - SUCCESS : DB Backup - Scheduled backup is enabled. Checking if a backup needs to be done now...
    [2020-04-01 03:30:09] - SUCCESS : DB Backup - Scheduled backup is enabled. Checking if a backup needs to be done now...
    [2020-04-01 17:34:31] - SUCCESS : DB Backup - Scheduled backup is enabled. Checking if a backup needs to be done now...
    

    and normal log

    
    [2020-04-01 14:39:23] - NOTICE : The following IP address range has been locked out for exceeding the maximum login attempts: 150.95.55
    [2020-04-01 17:14:12] - NOTICE : The following IP address range has been locked out for exceeding the maximum login attempts: 186.64.118
    [2020-04-01 17:34:31] - SUCCESS : DB Backup - Deleting all but 2 latest backup file(s) in /public_html/wp-content/aiowps_backups directory.
    [2020-04-01 17:45:03] - NOTICE : The following IP address range has been locked out for exceeding the maximum login attempts: 153.92.6
    

    From looking at the code, I’m guessing it’s failing during the aiowps_perform_fcd_scan_tasks action? I manually cleaned the tables to 5,000 entries like suggested in the DB cleanup maintenance.

    EDIT: I disabled db backup and was able to get it to run completely. Still diving into the code but it’s failing somewhere in execute_backup(). I added more debug prints to find a more concise placement and it’s during the write to back up file function.

    • This reply was modified 4 years, 8 months ago by jdwf0658.
    Thread Starter jdwf0658

    (@jdwf0658)

    Here is the due now cron list.

    
    action_scheduler_run_queue | 2020-04-01 17:30:13 | now | 1 minute
    wsal_detect_file_changes | 2020-04-01 17:30:15 | now | 10 minutes 
    smush_check_for_conflicts | 2020-04-01 17:30:29 | now | Non-repeating
    aiowps_hourly_cron_event | 2020-04-01 17:33:29 | now | 1 hour 
    

    Then this is during execution through CLI

    
    Executed the cron event 'action_scheduler_run_queue' in 0.463s.
    Executed the cron event 'wsal_detect_file_changes' in 0.031s.
    Executed the cron event 'smush_check_for_conflicts' in 0.097s.
    Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 16777224 bytes) in /public_html/wp-includes/wp-db.php on line 1996
    Error: There has been a critical error on your website.Learn more about debugging in WordPress. There has been a critical error on your website.
    

    I tried increasing memory limit in wp-config but couldn’t get it to execute fully.

    • This reply was modified 4 years, 8 months ago by jdwf0658.
    • This reply was modified 4 years, 8 months ago by jdwf0658.

    @pulpy you can put it into your child theme’s functions.php.
    Easy access to it through appearance>theme editor.
    Then wherever you want to display the tag cloud use the shortcode [custom_product_tags]

    I’ve adjusted it some to be a little bit better. You no longer have to edit it. Just c/p and it should work. I grab your domain dynamically in the code.

    
    add_shortcode('custom_product_tags', 'custom_product_tag_cloud_func');
    function custom_product_tag_cloud_func() {
    	if (is_shop()) {
    		//return all tags
    		$content = '<div class="widget_product_tag_cloud"><div class="tagcloud">';
    		$tags = wp_tag_cloud(array(
    			'format'                    => 'array',
    			'taxonomy'                  => 'product_tag',
    			'link'						=> 'view'
    		));
    		foreach ($tags as $tag) {
    			$content .= $tag;
    		}
    		$content .= '</div></div>';
    		return $content;
    	}
    	global $wp;
        $current_slug = add_query_arg( array(), $wp->request );
        if(strpos($current_slug, '/') !== false) {
            // explodable
            $newtest = explode('/', $current_slug);
    		$current_slug = array_pop($newtest);
    	} 
    	$args = array(
        	'category' => array( $current_slug ),
    		'limit' => -1
    	);
    	$products = wc_get_products( $args );
    	$tags_objects = array();
    	foreach ($products as $product) {
    		$tags = get_the_terms( $product->get_id(), 'product_tag' );
    		foreach ($tags as $tag) {
    			$slug = $tag->slug;
    			$cat_slug = add_query_arg( array(), $wp->request );
    			$tag->link = get_site_url()."/".$cat_slug."?product_tag=".$slug;
    			array_push($tags_objects, $tag);
    		}
    	}
    	$tags_objects = array_unique($tags_objects, SORT_REGULAR);
    	$tag_cloud = wp_generate_tag_cloud($tags_objects);
    	$content = '<div class="widget_product_tag_cloud"><div class="tagcloud">';
    	$content .= $tag_cloud;
    	$content .= '</div></div>';
    	return $content;
    }
    

    If there is a critical error on pages where shortcode is present, it’s because there are too many products in the category than your PHP memory limit is capable of handling. You can change the: limit => -1. To another number, perhaps 100 or 200 or ask your host to increase your PHP memory limit.

    Hope this helps! And the site will be up actually sometime next month. Thanks for checking!

    @alansn Well the codes made to be dynamic.
    If you wanted to have specific links, then can probably just manually recreate it with html and place it where you want it to be.

    If you want it’s style to be the same, just follow the html structure from the source code. Being sure to include the appropriate css classes so it looks uniform.

    In the code above; it grabs the last slug from the url and pull all products based on that categories slug. It then cycles through that specific categories products and grabs all their tags. It then dedupes the tags so there aren’t duplicates. I manually restructure the URL in this format “https://mywebsite.com/product-category/category-slug?product_tag=tag-slug&#8221; since the default structure is to take it to a main category tag page. but we want it to be filtered within the category the tags are selected on.

    After creating the necessary tag objects we “generate the tag cloud” which essentially is just structuring our tag objects into html output form.

    Lastly, I’m creating a website that will have lots of tutorials with un-lockable premium content, like a more detailed version of this shortcode to include various parameters. The domain is idkcode.com, currently under development. But worth bookmarking for various tips and tricks when it is live.

    If you wanted to generate to a specific product, you could change
    THIS:

    $args = array(
        	'category' => array( $current_slug ),
    		'limit' => -1
    	);
    	$products = wc_get_products( $args );

    TO THIS:

    $args = array(
        'include' => array( 134, 200, 210, 340 ),
    );
    $products = wc_get_products( $args );

    Where in 'include' => array($product_id, $product_id2, $product_id3, etc)
    you change the product_id variables to the product_id’s you want to generate tag clouds for.

    Oh and the slug structure is
    https://mywebsite.com/product-category/category-slug?product_tag=tag-slug

    And if you’ve restructured your permalinks to carry the shop page with it.
    https://mywebsite.com/shop/category-slug?product_tag=tag-slug

    so I coded a solution for this by creating a shortcode to reproduce the tag-cloud.
    Here is my code for other’s to use.
    What does the shortcode do? It creates a tag cloud based on the CURRENT category it is present in, as well as structures the URL to be within the child category, or parent if its top level + the product_tag filter.

    
    add_shortcode('custom_product_tags', 'custom_product_tag_cloud_func');
    function custom_product_tag_cloud_func() {
    	if (is_shop()) {
    		//return all tags
    		$content = '<div class="widget_product_tag_cloud"><div class="tagcloud">';
    		$tags = wp_tag_cloud(array(
    			'format'                    => 'array',
    			'taxonomy'                  => 'product_tag',
    			'link'						=> 'view'
    		));
    		foreach ($tags as $tag) {
    			$content .= $tag;
    		}
    		$content .= '</div></div>';
    		return $content;
    	}
    	global $wp;
        $current_slug = add_query_arg( array(), $wp->request );
        if(strpos($current_slug, '/') !== false) {
            // explodable
            $newtest = explode('/', $current_slug);
    		$current_slug = array_pop($newtest);
    	} 
    	$args = array(
        	'category' => array( $current_slug ),
    		'limit' => -1
    	);
    	$products = wc_get_products( $args );
    	$tags_objects = array();
    	foreach ($products as $product) {
    		$tags = get_the_terms( $product->get_id(), 'product_tag' );
    		foreach ($tags as $tag) {
    			$slug = $tag->slug;
    			$cat_slug = add_query_arg( array(), $wp->request );
    			$tag->link = "https://mywebsite.com/".$cat_slug."?product_tag=".$slug;
    			array_push($tags_objects, $tag);
    		}
    	}
    	$tags_objects = array_unique($tags_objects, SORT_REGULAR);
    	$tag_cloud = wp_generate_tag_cloud($tags_objects);
    	$content = '<div class="widget_product_tag_cloud"><div class="tagcloud">';
    	$content .= $tag_cloud;
    	$content .= '</div></div>';
    	return $content;
    }
    

    where $tag->link = “https://mywebsite.com&#8221; DONT FORGET TO CHANGE THIS TO YOUR DOMAIN

Viewing 13 replies - 1 through 13 (of 13 total)