Skip to:
Content
Pages
Categories
Search
Top
Bottom

Fatal error: Call to undefined function get_current_screen()


  • chrisipeters
    Participant

    @chrisipeters

    I’ve just updated my site to buddypress2.0, and now am unable to access the administration for the site.
    The site is running correctly, but every time I try to access any of the administration pages, I get: Fatal error: Call to undefined function get_current_screen() in /home/jenae20/public_html_cip_thecustomgolfshop/wp-content/plugins/buddypress/bp-members/bp-members-admin.php on line 825

    Looking up this line:

    if ( $this->users_page != get_current_screen()->id ) {
      return;
    }

    If I comment out the if clause, things seem to work ok. Just wondering why this is causing an error. Appreciate anyone’s help who could shed light on it!

Viewing 11 replies - 1 through 11 (of 11 total)

  • chrisipeters
    Participant

    @chrisipeters

    To add some context, I updated buddy press just after updating to wp 3.9


    chrisipeters
    Participant

    @chrisipeters

    After a bit of google searching, I found something that seems to have solved the issue.
    Just before the if clause shown above, I inserted:

    `require_once(ABSPATH . ‘wp-admin/includes/screen.php’);’

    Error gone.

    Hi @chrisipeters

    This line should only be run if a user query is made, in administration and if it’s not an ajax request. So this is really weird. Can you share the plugin you activated on your site that are dealing with users ?

    I think a simpler fix can be to add another if statement above like :

    if ( ! function_exists( 'get_current_screen' ) )
         return;

    Sorry for the inconvenience and thank you for the feedback.


    chrisipeters
    Participant

    @chrisipeters

    I am running bbPress for forums, and woo commerce, but other than that nothing user impacting.

    I did the WP3.9 update after which everything was fine,
    Then buddypress2.0, after which I experienced the error.

    Thanks for your feedback, can you confirm this patch is solving your issue ?


    chrisipeters
    Participant

    @chrisipeters

    Yes, this fix does work, thanks again for the quick response and help!


    bitpath
    Participant

    @bitpath

    Hi,
    Can you please help me with the exact same problem as well. I think I am up to date on all patches and just installed a bunch of premium plugins from wpmudev, but I was getting almost this exact same error trying to access admin screens this morning:
    Call to undefined function get_current_screen() in /home/bitpad/public_html/wp-content/plugins/buddypress/bp-members/bp-members-admin.php on line 825

    Your patch fixed it perfectly I think. I can now get back to the admin level. Thank you so much. I was worried I’d have to delete and reinstall plugin possibly starting over on a lot. I am now worried if I will break it by updating since it may over-write plugin patch you gave. Is all ok to upgrade next buddy press one that comes out?
    Thank you for your help! You saved a lot of grief 🙂

    hi @bitpath

    Don’t worry, it’s been committed to core and will be included in next upgrade
    https://buddypress.trac.wordpress.org/changeset/8304


    bitpath
    Participant

    @bitpath

    @imath Thanks so much!!


    ReichertBrothers
    Participant

    @reichertbrothers

    Just wanted to chime in and say the patch worked perfectly for me. I was the same error when trying to use a plugin to export user data to CSV. Works now, thanks @imath!

    you’re welcome @reichertbrothers and thanks for your feedback 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Fatal error: Call to undefined function get_current_screen()’ is closed to new replies.
Skip to toolbar