Мой плагин хранит пользовательские поля регистрации в одной строке базы данных, скажем, «custom_fields». Когда я печатаю custom_fields с помощью get_user_meta, я получаю массив всей информации, хранящейся там, например:
Код: Выделить всё
Array (
[0] => Array (
[invoice_company_name] => x
[invoice_nip] => x
[invoice_street] => x
[invoice_street_number] => x
[invoice_post_code] => x
[invoice_city] => x
[invoice_country] => x
[birth_date] => x
[birth_city] => x
[district] => x
)
)
Ну, я нашел функцию in_array(), поэтому попробовал сделать что-то подобное, но она не работает
Код: Выделить всё
$user_ID = get_current_user_id();
$all_meta_for_user = get_user_meta(
$user_ID,
'wp_s2member_custom_fields', false
);
print_r($all_meta_for_user);
if (in_array("[invoice_company_name]", $all_meta_for_user)) {
echo "exist";
} else {
echo 'dont exist';
}
А можно ли проверить все значения сразу? Что-то вроде in_array([1st]&&[2nd]&&[3rd])?
Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/227 ... a-2d-array
Мобильная версия