Skip to content

Commit

Permalink
= 4.2.7 =
Browse files Browse the repository at this point in the history
~ Fixed: case search LP ordes by user.
  • Loading branch information
tungnxt89 committed Aug 8, 2024
1 parent 805bb0b commit a630337
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/src/js/admin/init-tom-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const searchUserOnListPost = () => {
},
},
setting: {
placeholder: 'Choose author',
placeholder: 'Choose user',
},
};

Expand Down
8 changes: 5 additions & 3 deletions inc/custom-post-types/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,9 @@ public function posts_where_paged( $where ) {

// Search by author id
if ( ! empty( $wp_query->get( 'author' ) ) ) {
$user_id = $wp_query->get( 'author' );
$where .= $wpdb->prepare( ' AND uu.ID like %s ', $user_id );
$user_id = absint( $wp_query->get( 'author' ) );
//$where .= $wpdb->prepare( ' AND uu.ID like %s ', $user_id );
$where .= " AND ( pm1.meta_value like '%\"$user_id\"%' OR pm1.meta_value = $user_id ) ";
}

if ( ! empty( $wp_query->get( 'm' ) ) ) {
Expand Down Expand Up @@ -329,9 +330,10 @@ public function posts_join_paged( $join ) {
}

if ( ! empty( $wp_query->get( 'author' ) ) ) {
$author_id = $wp_query->get( 'author' );
$join .= " INNER JOIN {$lp_db->tb_postmeta} pm1 ON {$wpdb->posts}.ID = pm1.post_id AND pm1.meta_key = '_user_id'";
$join .= " INNER JOIN {$lp_db->tb_postmeta} pm2 ON {$wpdb->posts}.ID = pm2.post_id AND pm2.meta_key = '_order_total'";
$join .= " LEFT JOIN {$lp_db->tb_users} uu ON pm1.meta_value = uu.ID";
$join .= " LEFT JOIN {$lp_db->tb_users} uu ON uu.ID = $author_id";
}

return $join;
Expand Down

0 comments on commit a630337

Please sign in to comment.