fix response facet to type `Metadata_Types\User`

This commit is contained in:
vnmedeiros 2020-04-22 16:45:59 -03:00
parent 1c8fa4d8e7
commit ce292e0378
1 changed files with 5 additions and 0 deletions

View File

@ -1045,6 +1045,8 @@ class Metadata extends Repository {
$search_q = $wpdb->prepare("AND meta_value IN ( SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s )", '%' . $search . '%'); $search_q = $wpdb->prepare("AND meta_value IN ( SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s )", '%' . $search . '%');
} elseif ( $metadatum_type === 'Tainacan\Metadata_Types\Taxonomy' ) { } elseif ( $metadatum_type === 'Tainacan\Metadata_Types\Taxonomy' ) {
$search_q = $wpdb->prepare("AND t.name LIKE %s", '%' . $search . '%'); $search_q = $wpdb->prepare("AND t.name LIKE %s", '%' . $search . '%');
} if( $metadatum_type === 'Tainacan\Metadata_Types\User' ) {
$search_q = $wpdb->prepare("AND meta_value IN ( SELECT ID FROM $wpdb->users WHERE display_name LIKE %s )", '%' . $search . '%');
} else { } else {
$search_q = $wpdb->prepare("AND meta_value LIKE %s", '%' . $search . '%'); $search_q = $wpdb->prepare("AND meta_value LIKE %s", '%' . $search . '%');
} }
@ -1247,6 +1249,9 @@ class Metadata extends Repository {
continue; continue;
} }
$label = $_post->post_title; $label = $_post->post_title;
} elseif ( $metadatum_type === 'Tainacan\Metadata_Types\User' ) {
$name = get_the_author_meta( 'display_name', $label );
$label = apply_filters("tainacan-item-get-author-name", $name);
} }
$total_items = null; $total_items = null;