• Resolved cesarr1

    (@cesarr1)


    Hi, I have had a problem accessing the plugin’s admin section from within WP admin. This started happening ever since the 1.06 update. The plugin seems to be working fine otherwise i.e. visitors to my site can rate the posts, the ratings are being tabulated correctly, etc. The error I get when clicking on the GD Star Rating tab from within WP Admin is:
    Fatal error: Call to undefined function add_thickbox() in /home/oyemag/public_html/wp-content/plugins/gd-star-rating/gd-star-rating.php on line 1099

    Thank you for this great plugin and for the great support you provide!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Function that’s causing the problem is WordPress function, and has nothing to do with the plugin. This function loads thickbox jQuery plugin, but the problem is that this function is added in WordPress 2.6. I will replace it with the code that works with WP 2.5 also, but in the meantime you can make a change yourself:

    In gd-star-rating.php file, find the following line (should be line 1099 in 1.0.8 version of plugin):

    if ($this->admin_plugin) add_thickbox();

    And replace it with this:

    if ($this->admin_plugin) {
      wp_enqueue_script('thickbox');
      wp_enqueue_style('thickbox');
    }

    This should solve the problem you have.

    Milan

    Thread Starter cesarr1

    (@cesarr1)

    Hi Milan,

    Thank you very much for your help. I made the change you suggested and I now get a different error:

    Fatal error: Call to undefined function wp_enqueue_style() in /home/oyemag/public_html/wp-content/plugins/gd-star-rating/gd-star-rating.php on line 1101

    Thank you again for your assistance!

    Still the WP 2.5 problem, another function added in WP 2.6. Funny is that on all posts on this forum refering to this error recomendation is to install new version of WordPress. But, here is the solution that will work with WP 2.5:

    Modify gd-star-rating:

    Add this at line 718:

    if ($this->admin_plugin && $this->wp_version < 26)
    echo('<link rel="stylesheet" href="'.get_option('home').'/wp-includes/js/thickbox/thickbox.css" type="text/css" media="screen" />');

    Then you need to change the block changed with previeus post, and replace:

    if ($this->admin_plugin) {
      wp_enqueue_script('thickbox');
      wp_enqueue_style('thickbox');
    }

    with

    if ($this->admin_plugin) {
      if ($this->wp_version >= 26) add_thickbox();
      else wp_enqueue_script("thickbox");
    }

    I have just tested this solution and it works with 2.5.1. It will be included with next update, and will be available tomorrow on SVN.

    Regards,
    Milan

    Thread Starter cesarr1

    (@cesarr1)

    Milan,

    Thank you sir. You are a true professional. I will wait for the update tomorrow.

    I haven’t upgraded to 2.6 due to some plugin incompatibility issues, but will probably upgrade to 2.7 at some point.

    Thread Starter cesarr1

    (@cesarr1)

    Actually, I just made the changes myself and they worked. Thanks again!

    Great! Any more problems, I will be glad to help.

    Also, SVN gets updated daily, so all the latest fixes and all the new stuff are there.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: GD Star Rating] Plugin is working but can’t access admin…’ is closed to new replies.