• Resolved Nikhil

    (@codernik)


    Hi Support team,

    I’m facing an issue and details are as follows:

    WordPress version 5.5.1
    Current theme: OnePress (version 2.2.5)
    Current plugin: New User Approve (version 1.8.1)
    PHP version 7.2.30

    Error Details
    =============
    An error of type E_ERROR was caused in line 206 of the file /home/user/example.com/demo/wp-content/plugins/new-user-approve/includes/user-list.php. Error message: Uncaught Error: Call to undefined function get_current_screen() in /home/user/example.com/demo/wp-content/plugins/new-user-approve/includes/user-list.php:206
    Stack trace:
    #0 /home/user/example.com/demo/wp-includes/class-wp-hook.php(287): pw_new_user_approve_user_list->filter_by_status(Object(WP_User_Query))
    #1 /home/user/example.com/demo/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(”, Array)
    #2 /home/user/example.com/demo/wp-includes/plugin.php(544): WP_Hook->do_action(Array)
    #3 /home/user/example.com/demo/wp-includes/class-wp-user-query.php(582): do_action_ref_array(‘pre_user_query’, Array)
    #4 /home/user/example.com/demo/wp-includes/class-wp-user-query.php(77): WP_User_Query->prepare_query(Array)
    #5 /home/user/example.com/demo/wp-includes/user.php(579): WP_User_Query->__construct(Array)
    #6 /home/user/example.com/demo/wp-content/themes/onepress/inc/customizer.php(66): get_users(Array)
    #7 /hom

    This error occurred only when I opened the theme customizer present in Appearance Menu

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Nikhil

    (@codernik)

    Hi Team,

    We solved the issue on our own, here’s is what we did:

    public function filter_by_status( $query ) {
    		global $wpdb;
    
    		if ( !is_admin() ) {
    			return;
    		}
    
    		// bail early if not defined
    		if( !function_exists('get_current_screen') ) return;
    
    		$screen = get_current_screen();
    
    		// bail early if no screen
    		if( !$screen ) return;
    
    		if ( isset( $screen ) && 'users' != $screen->id ) {
    			return;
    		}
    • This reply was modified 4 years, 5 months ago by Nikhil.

    Hi @codernik,
    Thank you for contacting us, It’s nice to hear from you that the issue is resolved. Let us know if you have any other questions.

    Thanks!

    Thread Starter Nikhil

    (@codernik)

    Hi Team,

    Thanks, but you should consider pushing this fix for other people who are using this beautiful plugin.

    Hi @codernik,

    We have already forwarded the details to the QA Team we will surely be releasing an update including this fix.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Call to undefined function get_current_screen()’ is closed to new replies.