Plugin Directory

Changeset 2671569


Ignore:
Timestamp:
02/02/2022 06:23:26 PM (4 years ago)
Author:
socialproofy
Message:

all customers some bug fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • socialproofy/trunk/socialproofy.php

    r2671564 r2671569  
    8585    $users_query = get_users();
    8686    foreach ($users_query as $key => $item) {
    87         if ($key > 30) break;
     87        if ($key > 30)
     88            break;
    8889        $customer = socialproofy_generate_customer_data($item->ID);
    8990        $customers[] = $customer;
     
    439440function socialproofy_generate_customer_data($user_id)
    440441{
    441     $customer_data = get_user_meta($user_id);
    442 
    443     return $customer_data;
     442    $customer_data = array_map(function ($a) {
     443        return $a[0];
     444    }, get_user_meta($user_id));
     445
     446    if (!empty($customer_data)) {
     447        $customer = array(
     448            'customer_id' => $user_id,
     449            'nickname' => $customer_data['nickname'],
     450            'first_name' => $customer_data['first_name'],
     451            'country' => $customer_data['billing_country'],
     452            'city' => $customer_data['billing_city'],
     453        );
     454
     455        return $customer;
     456    }
     457
     458    return null;
    444459}
    445460
Note: See TracChangeset for help on using the changeset viewer.