includes/class-fep-rest-api.php
function users( $request ) {
global $wpdb;
$customers = $wpdb->get_results(“SELECT * FROM wp_project_db”);
foreach($customers as $data){
$response[] = array(
‘id’ => $user->ID,
‘nicename’ => $user->user_nicename,
‘name’ => fep_user_name( $user->ID ),
);
}
$response = [];
$for = $request->get_param( ‘for’ );
$q = $request->get_param( ‘q’ );
$x = $request->get_param( ‘x’ );
$exclude = ! $x ? array() : explode( ‘,’, $x );
// $exclude[] = get_current_user_id();
$args = array(
‘search’ => “*{$q}*”,
‘search_columns’ => array( ‘user_login’, ‘display_name’ ),
‘exclude’ => $exclude,
‘number’ => 10,
‘orderby’ => ‘display_name’,
‘order’ => ‘ASC’,
‘role__in’ => fep_get_option( ‘userrole_access’, array() ),
);
if ( strlen( $q ) > 0 ) {
if ( ‘autosuggestion’ === $for ) {
if ( ! fep_get_option( ‘show_autosuggest’, 1 ) && ! fep_is_user_admin() ) {
return rest_ensure_response( $response );
}
$args[‘exclude’][] = get_current_user_id();
$args = apply_filters( ‘fep_autosuggestion_arguments’, $args );
} elseif ( ‘multiple_recipients’ === $for ) {
$args[‘exclude’][] = get_current_user_id();
$args = apply_filters( ‘fep_users_ajax_arguments’, $args );
} elseif ( ‘blocked’ === $for ) {
$args[‘exclude’][] = get_current_user_id();
$args = apply_filters( ‘fep_users_ajax_arguments’, $args );
}
$args = apply_filters( ‘fep_filter_rest_users_args’, $args, $for, $q, $x );
if ( has_filter( “fep_filter_rest_users_response_{$for}” ) ) {
$response = apply_filters( “fep_filter_rest_users_response_{$for}”, $response, $args, $q, $x );
} elseif ( has_filter( ‘fep_filter_rest_users_response’ ) ) {
$response = apply_filters( ‘fep_filter_rest_users_response’, $response, $args, $for, $q, $x );
} else {
// The Query
$users = get_users( $args );
foreach ( $users as $user ) {
$response[] = array(
‘id’ => $user->ID,
‘nicename’ => $user->user_nicename,
‘name’ => fep_user_name( $user->ID ),
);
}
}
}
return rest_ensure_response( $response );
}
custom table query doesnot execute all types of query apply but it’snot working I can’t get data in message form To field