| Server IP : 89.108.64.180 / Your IP : 216.73.216.229 Web Server : Apache/2.4.41 (Ubuntu) System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-root ( 1010) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/poseidon-gagra.ru/wp-content/plugins/awebooking/inc/Core/ |
Upload File : |
<?php
/**
* Query customers and return customer IDs.
*
* @param string $term The search term.
* @param int $limit Limit the search results.
* @return array
*/
function abrs_search_customers( $term, $limit = 0 ) {
// Apply fillter to allow users custom the results.
$results = apply_filters( 'abrs_pre_search_customers', false, $term, $limit );
// If custom search results available, just return it.
if ( is_array( $results ) ) {
return $results;
}
$query = new WP_User_Query( apply_filters( 'abrs_customer_search_query', [
'fields' => 'ID',
'number' => $limit,
'search' => '*' . esc_attr( $term ) . '*',
'search_columns' => [ 'user_login', 'user_url', 'user_email', 'user_nicename', 'display_name' ],
], $term, $limit, 'main_query' ) );
$query2 = new WP_User_Query( apply_filters( 'abrs_customer_search_query', [
'fields' => 'ID',
'number' => $limit,
'meta_query' => [
'relation' => 'OR',
[
'key' => 'first_name',
'value' => $term,
'compare' => 'LIKE',
],
[
'key' => 'last_name',
'value' => $term,
'compare' => 'LIKE',
],
],
], $term, $limit, 'meta_query' ) );
// Merge the both results.
$results = wp_parse_id_list(
array_merge( (array) $query->get_results(), (array) $query2->get_results() )
);
// Limit the results.
if ( $limit && count( $results ) > $limit ) {
$results = array_slice( $results, 0, $limit );
}
return $results;
}