WordPress.org

Support

Support » How-To and Troubleshooting » Call to undefined function wp_register_sidebar_widget (WP 2.5)

Call to undefined function wp_register_sidebar_widget (WP 2.5)

  • I have just upgraded my wordpress blog 2.3.2 to the 2.5, and when I go to the admin dashboard (after upgrading the database [wp-admin/upgrade.php], of course) I get this error:

    Fatal error: Call to undefined function wp_register_sidebar_widget() in xxxxxxxxx/blog/wp-admin/includes/dashboard.php on line 31

    -I did deactivate the plugins
    -I did make a backup of my database
    -I did delete all the 2.3.2 files in my server (except for wp-config.php, an .htaccess and the wp-content)
    My blog front is working fine !

    I uploadead the 2.5 files twice, to see if there was a file missing.

Viewing 15 replies - 16 through 30 (of 30 total)
  • I downloaded K2 RC4, copied the new files over the old RC3 ones, and it appears to have fixed the error for me.

    Same to me 🙂

    @tibor: That worked great, thanks.

    For me, it was the Now Reading plugin. I had to go to phpMyAdmin and find the activated plugins and delete the Now Reading plugin from there. After doing so, all is back to normal.

    Hello Tibor,

    Thank you for posting the code above. I edited the file you specified and now I have my Admin panel again, but now when I go the URL in my browser, that code is sitting above the blog, at the top of the screen. How do I get that to go away and still keep the admin working?

    Oh, just in case you’d like to take a look, Here is the link.

    Thanks in advance for any help with this matter.

    @ BuffBillfan I don’t see the problem you describe, using Firefox or Safari. In FF though, the yellow header background does not show up.

    From clicking on the link, it seems @buffbillfan has fixed his problem.

    For anyone stumbling on this thread later though, his problem was due to the extra space character between the starting bracket and the question mark in the php snippets posted by @tibor above.

    Remove that space and you get the following, which will work correctly:

    <?php
    if (get_option(‘k2sidebarmanager’) == ‘1’) {
    remove_action(‘plugins_loaded’, ‘wp_maybe_load_widgets’, 0);
    if( is_admin() )
    {global $pagenow; if( $pagenow == ‘index.php’ ) wp_maybe_load_widgets();
    }
    }
    ?>

    For one of my user’s sites, this problem cropped with the Sidebar Module plugin. Fortunately they didn’t need it / weren’t using it and we were able to safely disable it.

    My problem was the Sidebar Module Reloaded plugin. deactivating it fixed the issue.

    i have the same problem: i cannot see my dashboard
    the message:

    Fatal error: Call to undefined function: wp_register_sidebar_widget() in /nfs/c01/h02/mnt/4820/domains/soundscapes.be/html/blog/wp-admin/includes/dashboard.php on line 32

    I am not using K2, but TripleK2 and don’t have the files you’re talking about. I do have app/includes/sbm.php
    i tried to replace this with the recent k2, but that didn’t work out well.
    anyone an idea what I can do to fix the dashboard?
    I don’t feel like making a new theme (it’s an modified theme which looks great in my opinion).

    The code of the sbm.php

    <?php

    function sbm_get_option($name) {
    global $k2sbm_current_module;

    return $k2sbm_current_module->get_option($name);
    }

    function sbm_add_option($name, $value = '', $description = '', $autoload = 'yes') {
    global $k2sbm_current_module;

    $k2sbm_current_module->add_option($name, $value, $description);
    }

    function sbm_update_option($name, $newvalue) {
    global $k2sbm_current_module;

    $k2sbm_current_module->update_option($name, $newvalue);
    }

    function sbm_delete_option($name) {
    global $k2sbm_current_module;

    $k2sbm_current_module->delete_option($name);
    }

    function register_sidebar($args = array()) {
    K2SBM::register_sidebar($args);
    }

    function unregister_sidebar($name) {
    K2SBM::unregister_sidebar($name);
    }

    function register_sidebars($count = 1, $args = array()) {
    K2SBM::register_sidebars($count, $args);
    }

    function dynamic_sidebar($name = 1) {
    return K2SBM::dynamic_sidebar($name);
    }

    function register_sidebar_module($name, $callback, $css_class = '', $options = array()) {
    K2SBM::register_sidebar_module($name, $callback, $css_class, $options);
    }

    function unregister_sidebar_module($name) {
    K2SBM::unregister_sidebar_module($name);
    }

    function is_active_module($callback) {
    return K2SBM::is_active_module($callback);
    }

    function register_sidebar_module_control($name, $callback) {
    K2SBM::register_sidebar_module_control($name, $callback);
    }

    function unregister_sidebar_module_control($name) {
    K2SBM::unregister_sidebar_module_control($name);
    }

    function register_sidebar_widget($name, $callback, $classname = '') {
    K2SBM::register_sidebar_module($name, $callback, $classname);
    }

    function unregister_sidebar_widget($name) {
    K2SBM::unregister_sidebar_module($name);
    }

    function is_active_widget($callback) {
    return K2SBM::is_active_module($callback);
    }

    function register_widget_control($name, $callback, $width = false, $height = false) {
    // Chop off W & H, not needed
    K2SBM::register_sidebar_module_control($name, $callback);
    }

    function unregister_widget_control($name) {
    K2SBM::unregister_sidebar_module_control($name);
    }

    ?>

    tx for trying to help.

    Thanks a lot @tibor and @davecahill, together you solved my problem using the Plainbox theme (based on K2) in the posts above. To me this is what did it:

    To fix the error:
    navigate to your K2 folder -> app -> includes
    edit the file widgets-removal.php as below

    Change the contents of the file from:

    <?php
    if (get_option(‘k2sidebarmanager’) == ‘1’) {
    remove_action(‘plugins_loaded’, ‘wp_maybe_load_widgets’, 0);
    }
    ?>
    to

    <?php
    if (get_option(‘k2sidebarmanager’) == ‘1’) {
    remove_action(‘plugins_loaded’, ‘wp_maybe_load_widgets’, 0);
    if( is_admin() )
    {global $pagenow; if( $pagenow == ‘index.php’ ) wp_maybe_load_widgets();
    }
    }
    ?>

    (That was Tibor’s advice, with davecahill’s correction).

    Any help with the sidebar module reloaded issue? It disables the WP Dashboard.

    Thanks @sjogro, this is soooo helpful.

    I’m not using K2. I just upgraded from 2.3.1 to 2.6 and I’m getting this error on register_sidebar() and when I comment that out, it changes to wp_register_sidebar_widget().

    I can access the other pages of the admin if I navigate to them manually. It seems that everything else works except for the dashboard. I guess since there’s a workaround, it’s not that big a deal, but I’d like to have it fully functioning.

    I deactivated all plugins before upgrading, and the plugin manager still shows them all as not active.

    Any ideas?

    I don’t even use K2 at all, I use cutline yet I just had these ridiculous query times that caused the cpu to exceed.

    # Sat Aug 30 21:24:50 2008
    # Query_time: 121 Lock_time: 78 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:52 2008
    # Query_time: 119 Lock_time: 74 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:52 2008
    # Query_time: 127 Lock_time: 81 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:52 2008
    # Query_time: 117 Lock_time: 72 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:52 2008
    # Query_time: 122 Lock_time: 77 Rows_sent: 1 Rows_examined: 1
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:52 2008
    # Query_time: 115 Lock_time: 70 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:52 2008
    # Query_time: 120 Lock_time: 75 Rows_sent: 1 Rows_examined: 0
    use ianbethu_wrdp1;
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.ID = 3836 AND wp_posts.post_type = ‘post’ ORDER BY wp_posts.post_date DESC

    # Sat Aug 30 21:24:53 2008
    # Query_time: 115 Lock_time: 72 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:53 2008
    # Query_time: 113 Lock_time: 71 Rows_sent: 1 Rows_examined: 1
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:53 2008
    # Query_time: 112 Lock_time: 70 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:53 2008
    # Query_time: 107 Lock_time: 65 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:53 2008
    # Query_time: 108 Lock_time: 66 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:53 2008
    # Query_time: 103 Lock_time: 61 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:53 2008
    # Query_time: 116 Lock_time: 70 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:57 2008
    # Query_time: 102 Lock_time: 91 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:58 2008
    # Query_time: 97 Lock_time: 87 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:58 2008
    # Query_time: 97 Lock_time: 87 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:58 2008
    # Query_time: 90 Lock_time: 81 Rows_sent: 1 Rows_examined: 1
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:58 2008
    # Query_time: 84 Lock_time: 75 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:58 2008
    # Query_time: 82 Lock_time: 73 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:58 2008
    # Query_time: 81 Lock_time: 72 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:58 2008
    # Query_time: 67 Lock_time: 59 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:58 2008
    # Query_time: 72 Lock_time: 64 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2installed’ LIMIT 1

    # Sat Aug 30 21:24:58 2008
    # Query_time: 41 Lock_time: 36 Rows_sent: 1 Rows_examined: 1
    use ianbethu_wrdp1;
    SELECT option_value FROM wp_options WHERE option_name = ‘k2deliciousname’ LIMIT 1

    afshin222

    @afshin222

    i have this problem also but when i use this code, this problem solved.

    function widget_dailytopten_init() {
            if(!function_exists('register_sidebar_widget')) { return; }
            function widget_dailytopten($args) {
    		echo $before_title
                          . 'My widget'
                          . $after_title;
    
    			Hello widget!
            }
            register_sidebar_widget('My sidget','widget_dailytopten');
        }
    add_action('plugins_loaded', 'widget_dailytopten_init');

    Regard, Afshin.m

Viewing 15 replies - 16 through 30 (of 30 total)
  • The topic ‘Call to undefined function wp_register_sidebar_widget (WP 2.5)’ is closed to new replies.