Support » Plugin: Wordpress Tooltips » Use of Deprecated functions

  • Resolved Arno Kools

    (@arno-kools)


    In ‘tooltipsfunctions.php’ two deprecated functions are used:
    r601+602 :

    
    function TooltipsWidgetInit()
    {	
    	register_sidebar_widget('Tooltips', 'tooltipsSidebar');
    	register_widget_control('Tooltips', 'tooltipsControl', 300, 200);
    }

    This can be easily fixed by replacing it with:
    `
    function TooltipsWidgetInit()
    {
    wp_register_sidebar_widget(‘Tooltips’, ‘tooltipsSidebar’);
    wp_register_widget_control(‘Tooltips’, ‘tooltipsControl’, 300, 200);
    }

    It’s not much of a big deal, but it would be nice if these changes are included in future updates. WordPress 4.6 didn’t like those old functions.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Arno Kools

    (@arno-kools)

    I made a little mistake here, should be:

    function TooltipsWidgetInit()
    {	
    	wp_register_sidebar_widget('TooltipsID','Tooltips', 'tooltipsSidebar');
    	wp_register_widget_control('TooltipsID','Tooltips', 'tooltipsControl', 300, 200);
    }

    The first argument has to be a unique id for the widget.
    BTW… I need to test if it’s working without errors now.
    Point is, these functions should be updated.

    There’s also another error message showing:

    : has_cap was called with an argument that is
    deprecated since version 2.0.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.

    deltafactory

    (@deltafactory)

    We’re looking to resolve this as well. If not fixed by the author then we’ll end up forking the plugin and fixing it on our own.

    Plugin Author Tomas Zhu

    (@zhuyi)

    Hi @arno-kools,

    Thanks for the message, sorry for the delay of the reply, I get a few sicks. I just come back released a new version and just find your question, I will check it and if this is a problem I will fix it in the next version, Thanks, have a good day. 🙂

    Best Regards,
    Tomas

    deltafactory

    (@deltafactory)

    @zhuyi, To resolve a few different deprecated calls in the plugin we’ve made the following patches:

    Fix query arg parameter:
    wp-content/plugins/wordpress-tooltips/tooltips.php:

    
    @@ -461,7 +461,7 @@ function tooltips_get_option($type)
       		'post_type' => $type,
       		'post_status' => 'publish',
       		'posts_per_page' => -1,
    -  		'caller_get_posts'=> 1
    +  		'ignore_sticky_posts'=> 1
     		);
     		$my_query = null;
     		$my_query = new WP_Query($args);
    

    Fix use of numeric levels in admin menu capability, use current widget functions:
    wp-content/plugins/wordpress-tooltips/tooltips.php

    
     function tooltipsMenu()
     {
     
    -	add_menu_page(__('Tooltips','Tooltips'), __('Tooltips','Tooltips'), 10, 'tooltipsfunctions.php','editTooltips');
    -	add_submenu_page('tooltipsfunctions.php',__('Edit Tooltips','Tooltips'), __('Edit Tooltips','Tooltips'),10, 'tooltipsfunctions.php','editTooltips');
    +	add_menu_page(__('Tooltips','Tooltips'), __('Tooltips','Tooltips'), 'manage_options', 'tooltipsfunctions.php','editTooltips');
    +	add_submenu_page('tooltipsfunctions.php',__('Edit Tooltips','Tooltips'), __('Edit Tooltips','Tooltips'), 'manage_options', 'tooltipsfunctions.php','editTooltips');
     }
     
     add_action('admin_menu', 'tooltips_menu');
     
     function tooltips_menu() {
    -	add_submenu_page('edit.php?post_type=tooltips',__('Global Settings','Tooltips'), __('Global Settings','Tooltips'),10, 'tooltipglobalsettings','tooltipGlobalSettings');
    +	add_submenu_page('edit.php?post_type=tooltips',__('Global Settings','Tooltips'), __('Global Settings','Tooltips'), 'manage_options', 'tooltipglobalsettings','tooltipGlobalSettings');
     }
     
     function showTooltips($content)
    

    We’ve also removed the line error_reporting(0); at the beginning of the plugin because this interferes with our debugging.

    Plugin Author Tomas Zhu

    (@zhuyi)

    Hi @deltafactory,

    Thanks for the message. 🙂

    I will check them and fix them in next version, about error_reporting(0), in version 3.6.1 I have follow users’ request to removed it, I am happy to work with a expert, maybe you are happy to share with me your github account? I believe you will see the new version soon, thanks, have a good day with your family. 🙂

    Best Regards,
    Tomas

    deltafactory

    (@deltafactory)

    @zhuyi I would be happy to collaborate.

    https://github.com/deltafactory/

    Plugin Author Tomas Zhu

    (@zhuyi)

    Hi @deltafactory,

    Thanks for the message. 🙂

    I am trying to find my github account access, but just found they said “8 million GitHub profiles were leaked from GeekedIn’s MongoDB”, source link: https://www.troyhunt.com/8-million-github-profiles-were-leaked-from-geekedins-mongodb-heres-how-to-see-yours/ , it seems it is better change the github password first. 🙂 Once I get back my github access I will follow you. 🙂

    Because it is 03:48am here, and I need some treatment at weekend yet, I believe you will see the new version next week once I come back. 🙂

    Thanks, have a great weekend with your family. 🙂

    Best Regards,
    Tomas

    • This reply was modified 6 years ago by Tomas Zhu.
    Plugin Author Tomas Zhu

    (@zhuyi)

    Hi,

    Dear @deltafactory and Dear @arno-kools, I have fixed the problem for replace deprecated functions register_sidebar_widget() and register_widget_control() with wp_register_sidebar_widget() and wp_register_widget_control(), I have tested it and it works well. Because I found another have a feature request and I am coding for it, I will publish the new version to wordpress.org once another feature be realized too, so users will not need upgrade always in a short time, however, you can download the new version of WordPress Tooltips 3.7.1 at https://tomas.zhu.bz/wordpress-tooltips-3-7-1-repalce-deprecated-functions.html/ first, thanks, have a good day with your family. 🙂

    Best Regards,
    Tomas

    Plugin Author Tomas Zhu

    (@zhuyi)

    Dear @deltafactory and Dear @arno-kools,

    The new version of wordpress tooltips 3.7.9 has been released in last week, in this version:

    1: I added Categories Support for a Tooltips in back end, you can manage your tooltips more easier
    2: I repalce deprecated functions register_sidebar_widget() and register_widget_control() with wp_register_sidebar_widget() and wp_register_widget_control()
    3: I Fixed a bug on tooltips widget
    Enjoy. 🙂

    Best Regards,
    Tomas

    Thread Starter Arno Kools

    (@arno-kools)

    Superb! Thanks for the follow-ups.

    @zhuyi, the capability argument of the menu calls (see function tooltipsMenu()) are using numeric values which were deprecated almost 10 years ago.

    See my longer comment above with specifics.

    Plugin Author Tomas Zhu

    (@zhuyi)

    Hi @deltafactory,

    Thanks for the reply. 🙂

    You are right, the numeric values was deprecated many years before, you are expert. 🙂 It seems maybe you start working on WP at lease wordpress 1.5? 🙂

    I have changed the numeric values with ‘manage_options’, thanks, have a blessings day with your family. 🙂

    Best Regards,
    Tomas

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Use of Deprecated functions’ is closed to new replies.