WordPress.org

Forums

Jetpack by WordPress.com
[resolved] editable roles / Statistic failure (11 posts)

  1. Alduras
    Member
    Posted 2 years ago #

    After installing the update I gat this failure:

    Fatal error: Call to undefined function get_editable_roles() in /srv/http/xyz.com/wp-content/plugins/jetpack/modules/stats.php on line 219

    After going into the backend and reloading the statistic configuration everything is ok again on the frontend.

    Please correct the failure!

    http://wordpress.org/extend/plugins/jetpack/

  2. vortodox
    Member
    Posted 2 years ago #

    Same problem here too.

  3. rolandinsh
    Member
    Posted 2 years ago #

    same here, fast search say get_editable_roles() is only since WordPress 3.6

  4. vortodox
    Member
    Posted 2 years ago #

    For now I just renamed jetpack folder, and site is woking, but i don't have jetpack xD

  5. rolandinsh
    Member
    Posted 2 years ago #

    quick fix:

    if(!function_exists( 'get_editable_roles' )){
    function get_editable_roles() {
      global $wp_roles;
      $all_roles = $wp_roles->roles;
      $editable_roles = apply_filters('editable_roles', $all_roles);
      return $editable_roles;
    }
    }
  6. Andy Skelton
    Member
    Plugin Author

    Posted 2 years ago #

    I must apologize for the bug. I didn't realize that get_editable_roles function is only loaded in admin, making it potentially unsafe to call from stats_upgrade_options when the next page load after upgrade is a non-admin page. The fix has been committed to the Jetpack plugin. The next bugfix release will include this.

    Meanwhile, you should be able to work around the issue by loading just one wp-admin page after upgrading the plugin. This should trigger stats_upgrade_options.

  7. shadowofiris
    Member
    Posted 2 years ago #

    Would the quick fix go in the functions file or in Jet Pack plugin itself?

    When I'm logged into admin my site works, but when I'm not logged in, my entire site generates the error. I don't understand what it means just to load one wp-admin page after upgrade.

    My site is here:
    http://www.shadowofiris.com

    Please help.

  8. shadowofiris
    Member
    Posted 2 years ago #

    Okay, I figured it out, you go to Jetpack/module/stats and edit the function that is centered on line 219 ... that seems to be working. Thank you.

  9. jmeeter
    Member
    Posted 2 years ago #

    @shadowofiris what do you mean by "fix it"?

  10. shadowofiris
    Member
    Posted 2 years ago #

    @jmeeter:

    Some of the pages on my site were generating the error given at the start of this thread:
    "Fatal error: Call to undefined function get_editable_roles() in /srv/http/xyz.com/wp-content/plugins/jetpack/modules/stats.php on line 219"

    I went to jetpack folder, module folder, stats file, and replaced the function that centers around line 219 with the code provided by Umbrovskis.com. After doing this the problem seems to have gone away.

  11. serkan.nyc
    Member
    Posted 2 years ago #

    I just added this codes and it started to working

    function get_editable_roles() {
        global $wp_roles;
    
        $all_roles = $wp_roles->roles;
        $editable_roles = apply_filters('editable_roles', $all_roles);
    
        return $editable_roles;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Jetpack by WordPress.com
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic