• Resolved Antipole

    (@antipole)


    Looks like the author will not be fixing this.

    @dsmiller submitted a fix here but I cannot relate it to my copy of the code. Lines 888-891 in my copy are:

    class sb_cl_pages_widget extends WP_Widget {
        function sb_cl_pages_widget() {
            parent::WP_Widget(false, 'SB Child List Widget');	
        }

    which I cannot relate to the proffered fix.

    Can anyone help, please?

Viewing 5 replies - 1 through 5 (of 5 total)
  • On version 4.4 (which I believe is the latest), you should replace the entirety of function “sb_cl_pages_widget()” (which is the constructor for the widget, using the deprecated method of declaring a function with the same name as the class), with the proferred code (modified from the original–I realized that some localization code was in there, and I’ve reduced it to the simplest non-deprecated replacement):

    
    function __construct() {
        parent::__construct (
            false, // Base ID
            'SB Child List Widget' // Name
        );		
    }

    In the interest of responding in a timely manner, I’ve simplified the code without testing (but I will do so later today). If you have any issues, post back here and I’ll help work through them.

    Thread Starter Antipole

    (@antipole)

    I made following change:

    /* This method of declaring widget deprecated
    class sb_cl_pages_widget extends WP_Widget {
        function sb_cl_pages_widget() {
            parent::WP_Widget(false, 'SB Child List Widget');	
        }
    Replaced with:
    */
    function __construct() {
        parent::__construct (
            false, // Base ID
            'SB Child List Widget' // Name
        );
        }	
    /* end of replacement */ 

    But it fails to load as it has a missing } somewhere.
    Not sure where it is needed.
    Sorry if that sounds pathetic, but I am unfamiliar with constructors.

    Plugin Author Sean Barton

    (@seanbarton)

    My apologies everyone. I’ve been extremely busy with other projects and this is an older plugin. I’ve fixed the constructor and sorted out a couple of general PHP Notices in the plugin. Let me know if there are any issues. Grab V4.5 via your dashboards now.

    ta
    S

    Thread Starter Antipole

    (@antipole)

    That’s great Sean! Thank you!

    It may be an old plugin, but it is much valued by me and others.

    Plugin Author Sean Barton

    (@seanbarton)

    Glad you’re still using it and enjoying it. If anything else breaks let me know and I’ll sort.

    ta
    S

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cleaning up deprecated constructor – again’ is closed to new replies.