• Resolved Sander

    (@sander-falise)


    I received an error, unrelated to any pods action, when doing an ajax action over wp-admin/ajax.php

    I got the following error:

    PHP Fatal error: Uncaught Error: Call to undefined function get_current_screen() in /wp-content/plugins/pods/classes/fields/avatar.php:308

    I fixed it by adding a function_exists( ‘get_current_screen’ ) to the allow_avatar_overwrite() method.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @sander-falise

    What kind of AJAX call are you making?
    When on the admin side I would assume that function is available.

    Cheers, Jory

    Plugin Author Jory Hogeveen

    (@keraweb)

    And if you want, you could create a pull request on GitHub with this fix and how to reproduce it!

    Cheers, Jory

    Thread Starter Sander

    (@sander-falise)

    Hi Jory,

    As you know, get_current_screen() is not always available in early hooks so it is good practice to do a function_exists(..) beforehand.

    The error occurs in the Events Manager (Pro) plugin when making a reservation for an event as a new user (not logged in).

    Groetjes, Sander.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @sander-falise

    I’m aware of this and had a patch ready, though I thought maybe you wanted to make the pull request and get the credits 🙂
    Anyhow, patch is made an PR is created on GitHub. It will be fixed in the next update!
    https://github.com/pods-framework/pods/pull/6008

    Cheers, Jory

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

The topic ‘get_current_screen error when accessing wp-admin/ajax.php’ is closed to new replies.