Stephan

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

    Posts

  • Stephan

    Participant

    We are upgrading our servers PHP version to 7.3 (soon 7.4) and git the same PHP notice:
    Deprecated: Function create_function() is deprecated in /Users/joan/Sites/netzstrategen/wopa/htdocs/local-plugins/woocommerce-custom-tabs-pro/woocommerce-custom-tabs-pro.php on line 276

    Our proposed solution is to substitute the create_function() call with an anonymous function. I.e. Change lines 272-276 in file woocommerce-custom-tabs-pro/woocommerce-custom-tabs-pro.php:
    Before

    
    				//callback is a dynamic function, it is call $this->woocommerce_tab_content function with $tab_code parameter 			
    				$tabs[ $product_tabpage_post -> post_name ] = array(
    				'title' 	=> do_shortcode( $tab_custom_title == '' ? $product_tabpage_post -> post_title : $tab_custom_title ),
    				'priority' 	=> $priority,
    				'callback' 	=> create_function('',  'global $wct; $wct->woocommerce_tab_content("' . $product_tabpage_post -> post_name . '", ' . $product_tabpage_post->ID . ');'  ),
    

    After

    
    //callback is a dynamic function, it is call $this->woocommerce_tab_content function with $tab_code parameter
    				$callback = function($post_name, $post_id) {
    						global $wct;
    						$wct->woocommerce_tab_content($post_name, $post_id);
    					};
    
    				$tabs[ $product_tabpage_post -> post_name ] = array(
    				'title' 	=> do_shortcode( $tab_custom_title == '' ? $product_tabpage_post -> post_title : $tab_custom_title ),
    				'priority' 	=> $priority,
    				'callback' => $callback($product_tabpage_post->post_name, $product_tabpage_post->ID)
    				);
    

    As a diff:

    
    diff --git a/woocommerce-custom-tabs-pro/woocommerce-custom-tabs-pro.php b/woocommerce-custom-tabs-pro/woocommerce-custom-tabs-pro.php
    index 5fd17560..9d0356de 100644
    --- a/local-plugins/woocommerce-custom-tabs-pro/woocommerce-custom-tabs-pro.php
    +++ b/local-plugins/woocommerce-custom-tabs-pro/woocommerce-custom-tabs-pro.php
    @@ -269,11 +269,15 @@ class WCT {
                                    //x$priority = $priority_field_object['value'];
                                    $priority = get_field('priority', $product_tabpage_post->ID, false);
            
    -                               //callback is a dynamic function, it is call $this->woocommerce_tab_content function with $tab_code parameter                   
    +                               //callback is a dynamic function, it is call $this->woocommerce_tab_content function with $tab_code parameter^M
    +                               $callback = function($post_name, $post_id) {^M
    +                                               global $wct;^M
    +                                               $wct->woocommerce_tab_content($post_name, $post_id);^M
    +                                       };^M
                                    $tabs[ $product_tabpage_post -> post_name ] = array(
                                    'title'         => do_shortcode( $tab_custom_title == '' ? $product_tabpage_post -> post_title : $tab_custom_title ),
                                    'priority'      => $priority,
    -                               'callback'      => create_function('',  'global $wct; $wct->woocommerce_tab_content("' . $product_tabpage_post -> post_name . '", ' . $product_tabpage_post->ID . ');'  ),
    +                               'callback' => $callback($product_tabpage_post->post_name, $product_tabpage_post->ID)^M
                                    );
                            } 
    

    Stephan

    Participant

    We are currently on php 7.1 on a live site using woocommerce-custom-tabs-pro plugin. Soon we will migrate to php 7.2, so from then, the warning will appear in the front-end. Thus, we need this deprecation function to be replaced so the user is not visualising this warning.

    We propose a solution attached to this comment.

    Please, consider applying those changes.

    Thank you


    in reply to: Custom Tabs Pro License Key

    #8343

    Stephan

    Participant

    Hello,
    another understanding question about the license:
    in the download area it says that the license never expires, so our question is why the license key is not valid?

    regards,
    Elena


    in reply to: Custom Tabs Pro License Key

    #8339

    Stephan

    Participant

    hello,

    i was just about to enter the key (wc_order…zx5FHn), but i get the message that the invalid request is.
    do we need to renew the license?

    • This reply was modified 5 years, 9 months ago by WebshopLogic.

Viewing 4 posts - 1 through 4 (of 4 total)