Friends widget constructor error

When my multisite is in debug mode I get the following errors from the Friends plugin...

Notice: The called constructor method for WP_Widget in WPMUDev_Friends_Widget is deprecated since version 4.3.0! Use
__construct()
instead. in /home/bubctty007/public_html/wp-includes/functions.php on line 3903

Warning: Cannot modify header information - headers already sent by (output started at /home/bubctty007/public_html/wp-includes/functions.php:3903) in /home/bubctty007/public_html/wp-includes/pluggable.php on line 1216

The plugin works fine, otherwise, but I have to disable the Friends plugin whenever I enable debug mode. Is there a fix for this?

Thanks :slight_smile:

  • Adam Czajczyk

    Hello Tedster

    I hope you're well today and thank you for your question!

    We are already aware of this. I'm not able to give you an ETA but it's already reported to our developers so they could take a look into the issue.

    Fortunately, it's a "warning", not an error. The "deprecated" message means that the plugin is using some function/method that is "not recommended" anymore and will be removed from WordPress or PHP but is not removed yet and is working as it was.

    The simplest way to deal with it while working with DEBUG mode enabled would be to actually redirect DEBUG output to a file. That's recommended anyway as printing out debugging messages to the screen might in fact cause some messages to be skipped (that's because when some output goes to the screen, the "headers already sent" error shows up as a consequence and blocks further processing of the site). In other words, apart from addressing the problem that you reported, writing debug output to a file might also give you a better insight into other issues :slight_smile:

    You can achieve it by setting these two lines in "wp-config.php" file (in addition to the one that's enabling DEBUG mode):

    // write debug output to file
    define( 'WP_DEBUG_LOG', true);
    // do not display it on site
    define( 'WP_DEBUG_DISPLAY', false);

    Best regards,
    Adam

  • Tedster

    Thank you for your effort, Vaughan, but I'm taking a different route for friends networking on my site. This is not because the warning thrown by the widget but, rather, because the plugin does not quite suit my needs. I've decided to make my own plugin based on the Friends plugin but without some of the core features, such as the widget. Still, I'm going to throw some points your way because I do appreciate that you took the time to create a fix for this issue. I hope others will find your fix useful until the plugin is updated.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.