Support » Plugin: Currency Converter » How to fix Notice about constructor method for WP_Widget

  • Resolved Marco Chiesi

    (@marcochiesi)


    I wanted to reply to this topic but unfortunately it’s closed.

    WP_Widget is not deprecated. What is deprecated is the usage of the WP_Widget constructor having the same name of the class. This is a general PHP issue, see PHP documentation.

    By the way the WP_Widget constructor is explicitely called inside the currency_converter constructor of the currency_converter class.

    The fix as easy as change

    
    	function currency_converter() {
    		#Widget settings
    		$widget_ops = array( 'description' => __('Currency Converter for any currency in the world', 'currency_conveter') );
    
    		#Widget control settings
    		$control_ops = array( 'width' => 200, 'height' => 550, 'id_base' => 'currency_converter' );
    
    		#Create the widget
    		$this->WP_Widget( 'currency_converter', __('Currency Converter', 'currency_converter'), $widget_ops, $control_ops );
    	}
    

    to

    
    	function __construct() {
    		#Widget settings
    		$widget_ops = array( 'description' => __('Currency Converter for any currency in the world', 'currency_conveter') );
    
    		#Widget control settings
    		$control_ops = array( 'width' => 200, 'height' => 550, 'id_base' => 'currency_converter' );
    
    		#Create the widget
    		parent::__construct( 'currency_converter', __('Currency Converter', 'currency_converter'), $widget_ops, $control_ops );
    	}
    

    I hope that you could fix this in the next releases, because this kind of errors is very annoying when working with WP_DEBUG enabled.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author enclick

    (@enclick)

    Marco

    thank you, I will get on it

    Regards
    Salber

    Plugin Author enclick

    (@enclick)

    Marco

    the fix has been uploaded

    version 2.3.1

    Regards
    Salber

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to fix Notice about constructor method for WP_Widget’ is closed to new replies.