• amila

    (@flatworld21)


    Hi, I am using WP_User_Query to select users include languages.
    I found that users can not speak Japanese(user_japanese=0) can be selected by parameter (user_japanese=1)
    Any one knows the reason? I output the two arrays here, and you can search “user_japanese”

    var_dump( get_user_meta(54));

    array
      'nickname' => 
        array
          0 => string 'teacher004' (length=10)
      'first_name' => 
        array
          0 => string '' (length=0)
      'last_name' => 
        array
          0 => string '' (length=0)
      'description' => 
        array
          0 => string '' (length=0)
      'rich_editing' => 
        array
          0 => string 'true' (length=4)
      'comment_shortcuts' => 
        array
          0 => string 'false' (length=5)
      'admin_color' => 
        array
          0 => string 'fresh' (length=5)
      'use_ssl' => 
        array
          0 => string '0' (length=1)
      'show_admin_bar_front' => 
        array
          0 => string 'true' (length=4)
      'shopper_capabilities' => 
        array
          0 => string 'a:1:{s:6:"author";b:1;}' (length=23)
      'shopper_user_level' => 
        array
          0 => string '2' (length=1)
      'olbgroup' => 
        array
          0 => string 'teacher' (length=7)
      'dismissed_wp_pointers' => 
        array
          0 => string '' (length=0)
      'pmpro_stripe_updates' => 
        array
          0 => string 'a:0:{}' (length=6)
      'user_address' => 
        array
          0 => string '' (length=0)
      'user_phone' => 
        array
          0 => string '' (length=0)
      'user_skype' => 
        array
          0 => string 'yetty_forever' (length=13)
      'last_update' => 
        array
          0 => string '1472686990' (length=10)
      'olbprofile' => 
        array
          0 => string '2411' (length=4)
      'session_tokens' => 
        array
          0 => string 'a:1:{s:64:"308f3c74dd974d312b6a6bc0ebf6d86dc9aa6b1d66fa285d8ad6175cd1bafdd3";a:4:{s:10:"expiration";i:1478065542;s:2:"ip";s:9:"127.0.0.1";s:2:"ua";s:109:"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36";s:5:"login";i:1476855942;}}' (length=292)
      'pmpro_logins' => 
        array
          0 => string 'a:5:{s:4:"last";s:16:"October 19, 2016";s:8:"thisdate";N;s:5:"month";i:1;s:9:"thismonth";s:2:"10";s:7:"alltime";i:2;}' (length=117)
      'pmpro_views' => 
        array
          0 => string 'a:4:{s:4:"last";s:16:"October 19, 2016";s:5:"month";i:50;s:7:"alltime";i:56;s:9:"thismonth";s:2:"10";}' (length=102)
      'manageedit-shop_ordercolumnshidden' => 
        array
          0 => string 'a:1:{i:0;s:15:"billing_address";}' (length=33)
      'pmpro_visits' => 
        array
          0 => string 'a:5:{s:4:"last";s:16:"October 19, 2016";s:8:"thisdate";N;s:5:"month";i:1;s:9:"thismonth";s:2:"10";s:7:"alltime";i:1;}' (length=117)
      'user_age' => 
        array
          0 => string '24' (length=2)
      'user_english' => 
        array
          0 => string '1' (length=1)
      'user_japanese' => 
        array
          0 => string '0' (length=1)
      'user_gender' => 
        array
          0 => string '1' (length=1)

    var_dump($args[‘meta_query’]);

    array
      'relation' => string 'AND' (length=3)
      0 => 
        array
          'key' => string 'olbgroup' (length=8)
          'value' => string 'teacher' (length=7)
          'compare' => string '=' (length=1)
          'type' => string 'CHAR' (length=4)
      1 => 
        array
          'key' => string 'user_gender' (length=11)
          'value' => string '1' (length=1)
          'type' => string 'numeric' (length=7)
          'compare' => string '=' (length=1)
      2 => 
        array
          'key' => string 'user_age' (length=8)
          'value' => 
            array
              0 => int 20
              1 => int 29
          'type' => string 'numeric' (length=7)
          'compare' => string 'BETWEEN' (length=7)
      3 => 
        array
          'key' => string 'user_japanese' (length=13)
          'value' => string '1' (length=1)
          'compare' => string '=' (length=1)
    • This topic was modified 8 years, 1 month ago by amila.
  • The topic ‘WP_User_Query problem’ is closed to new replies.