diff options
Diffstat (limited to 'includes/concert.php')
-rw-r--r-- | includes/concert.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/includes/concert.php b/includes/concert.php index 8609694..a67364f 100644 --- a/includes/concert.php +++ b/includes/concert.php @@ -208,6 +208,7 @@ if ( !class_exists('GiglogAdmin_Concert') ) { ]; $where = []; + $lmt=[]; foreach( $filter as $key => $value ) { switch ($key) { case 'name': @@ -219,12 +220,20 @@ if ( !class_exists('GiglogAdmin_Concert') ) { case 'id': case 'venue_id': - array_push($where, $wpdb->prepare($keymap[$key] . '=%d', $value)); - break; + array_push($where, $wpdb->prepare($keymap[$key] . '=%d', $value)); + break; case 'currentuser': - array_push($where , $wpdb->prepare($keymap[$key] . ' like "%%%s%%"', $value)); - break; + array_push($where , $wpdb->prepare($keymap[$key] . ' like "%%%s%%"', $value)); + break; + + case 'offset': + array_push($lmt , $value); + break; + + case 'recperpage': + array_push($lmt , $value); + break; } } @@ -234,6 +243,10 @@ if ( !class_exists('GiglogAdmin_Concert') ) { $query.= ' ORDER BY wpgconcert_date'; + if ( ! empty( $lmt ) ) { + $query .= ' LIMIT ' . implode(', ', $lmt); + } + $results = $wpdb->get_results($query); return array_map(function($c) { return new GiglogAdmin_Concert($c); }, $results); |