Support » Plugin: Improved user search in backend » Search Doesn't Return Results – mysql_real_escape_string Error

  • Hello,

    I found an issue with the plugin not functioning due to the mysql_real_escape_string, I found nothing was being returned except the following errors;

    WARNING: wp-content/plugins/improved-user-search-in-backend/improved-user-search-in-backend.php:50 - mysql_real_escape_string(): Access denied for user '***'@'localhost' (using password: NO)
    WP_Users_List_Table->prepare_items, WP_User_Query->__construct, WP_User_Query->prepare_query, do_action_ref_array, call_user_func_array, user_search_by_multiple_parameters, mysql_real_escape_string
    WARNING: wp-content/plugins/improved-user-search-in-backend/improved-user-search-in-backend.php:50 - mysql_real_escape_string(): A link to the server could not be established
    WP_Users_List_Table->prepare_items, WP_User_Query->__construct, WP_User_Query->prepare_query, do_action_ref_array, call_user_func_array, user_search_by_multiple_parameters, mysql_real_escape_string

    Looking into the error it appears the function is deprecated for PHP 5.5, I tried the msqli version ( mysqli_real_escape_string but that requires a db connection. I found that establishing one can be avoided by simply using the wpdb escape function $wpdb->escape(). So the fix is to update line 50 as follows;
    $qstr = $wpdb->escape($_GET["s"]);

    Hope this helps someone.
    Cheers

    https://wordpress.org/plugins/improved-user-search-in-backend/

Viewing 1 replies (of 1 total)
  • THANK YOU THANK YOU THANK YOU!!!!!!!!!!!!! OMG, YOU ROCK THE FREE WORLD, MAN! This fixed the problem. *does the Snoopy dance*

    [signature line removed]

Viewing 1 replies (of 1 total)
  • The topic ‘Search Doesn't Return Results – mysql_real_escape_string Error’ is closed to new replies.