PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/order/class-lp-order.php +13 -7 4.4.64.4.8 View file →
@@ -1505,9 +1505,9 @@
1505 1505 *
1506 1506 * @return void
1507 1507 * @throws Exception
1508 1508 * @since 4.3.2.8
1509 - * @version 1.0.1
1509 + * @version 1.0.2
1510 1510 */
1511 1511 public static function handle_params_query_list_orders( PostFilter &$post_filter, array $param = array() ) {
1512 1512 $post_db = PostDB::getInstance();
1513 1513 $user_of_order = absint( $param['author'] ?? 0 );
@@ -1516,9 +1516,9 @@
1516 1516 $month = $param['m'] ?? '';
1517 1517 $limit = $param['posts_per_page'] ?? 20;
1518 1518 $paged = $param['paged'] ?? 1;
1519 1519 $refund_request_status = sanitize_key( (string) ( $param['refund_request_status'] ?? '' ) );
1520 - $order_by = $param['orderby'] ?? 'date';
1520 + $order_by = $param['orderby'] ?? 'menu_order';
1521 1521 if ( empty( $order_by ) ) {
1522 1522 $order_by = 'ID';
1523 1523 } else {
1524 1524 switch ( $order_by ) {
@@ -1530,9 +1530,10 @@
1530 1530 'ID',
1531 1531 'post_title',
1532 1532 'post_author',
1533 1533 'post_status',
1534 - 'order_total'
1534 + 'order_total',
1535 + 'menu_order'
1535 1536 );
1536 1537 if ( ! in_array( $order_by, $allowed_key ) ) {
1537 1538 $order_by = 'ID';
1538 1539 }
@@ -1544,10 +1545,9 @@
1544 1545 // End convert params
1545 1546
1546 1547 if ( $order_by === 'order_total' ) {
1547 1548 $post_filter->join[] = "INNER JOIN {$post_db->tb_postmeta} pm2 ON p.ID = pm2.post_id AND pm2.meta_key = '_order_total'";
1548 - $post_filter->where[] = 'AND CAST(pm2.meta_value AS UNSIGNED)';
1549 - $post_filter->order_by = 'pm2.meta_value';
1549 + $post_filter->order_by = 'CAST(pm2.meta_value AS DECIMAL(10,2))';
1550 1550 } else {
1551 1551 $post_filter->order_by = $order_by;
1552 1552 }
1553 1553
@@ -1579,12 +1579,18 @@
1579 1579 }
1580 1580
1581 1581 if ( ! empty( $month ) ) {
1582 1582 $year = substr( $month, 0, 4 );
1583 - $post_filter->where[] = "AND YEAR(p.post_date) = $year";
1583 + $post_filter->where[] = $post_db->wpdb->prepare(
1584 + 'AND YEAR(p.post_date) = %s',
1585 + $year
1586 + );
1584 1587 if ( strlen( $month ) > 5 ) {
1585 1588 $mon = substr( $month, 4, 2 );
1586 - $post_filter->where[] = "AND MONTH(p.post_date) = $mon";
1589 + $post_filter->where[] = $post_db->wpdb->prepare(
1590 + 'AND MONTH(p.post_date) = %s',
1591 + $mon
1592 + );
1587 1593 }
1588 1594 }
1589 1595
1590 1596 $post_filter->order = $order;