PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 3.5.4
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v3.5.4
3.5.4 3.5.3 3.5.2 3.5.1 3.4.9 3.5.0 3.4.8 3.4.7 trunk 2.3.1 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6
← All changes | includes/models/class-wpsc-agent.php +10 -1 3.5.3 → 3.5.4 View file →
@@ -571,12 +571,21 @@
571 571 * @return array
572 572 */
573 573 public static function agent_autocomplete( $filters ) {
574 574
575 + // Whitelisted map of accepted sort_by values to actual DB columns - only
576 + // the two options offered in the sort-by dropdown are valid here.
577 + $sortable_columns = array(
578 + 'name' => 'name',
579 + 'workload' => 'workload',
580 + );
581 + $orderby = isset( $sortable_columns[ $filters['sort_by'] ] ) ?
582 + $sortable_columns[ $filters['sort_by'] ] : 'name';
583 +
575 584 $args = array(
576 585 'search' => $filters['term'],
577 586 'items_per_page' => 25,
578 - 'orderby' => $filters['sort_by'],
587 + 'orderby' => $orderby,
579 588 'order' => 'ASC',
580 589 'meta_query' => array(
581 590 'relation' => 'AND',
582 591 array(