summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-05-10 10:45:04 +0200
committerHarald Eilertsen <haraldei@anduin.net>2021-05-10 10:45:04 +0200
commitae72f1b2f0c73ded5277300f0d15914e6e10ecae (patch)
treeacda885c4785fec568a4a01a32e308034600ebce /includes
parent61c48191a8e9ab757be4bf845072f4cfdbf9075f (diff)
downloadgigologadmin-ae72f1b2f0c73ded5277300f0d15914e6e10ecae.tar.gz
gigologadmin-ae72f1b2f0c73ded5277300f0d15914e6e10ecae.tar.bz2
gigologadmin-ae72f1b2f0c73ded5277300f0d15914e6e10ecae.zip
Make it possible to list all concerts.
Diffstat (limited to 'includes')
-rw-r--r--includes/concert.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/includes/concert.php b/includes/concert.php
index 050c924..455bc82 100644
--- a/includes/concert.php
+++ b/includes/concert.php
@@ -171,14 +171,17 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
}
- public static function find_concerts_in(string $city) : array
+ public static function find_concerts_in(?string $city = null) : array
{
global $wpdb;
$query = 'SELECT wpg_concerts.*, wpg_venues.wpgvenue_name, wpg_venues.wpgvenue_city '
. 'FROM wpg_concerts '
- . 'INNER JOIN wpg_venues ON wpg_concerts.venue = wpg_venues.id '
- . 'WHERE wpg_venues.wpgvenue_city = ' . $wpdb->prepare('%s', $city);
+ . 'INNER JOIN wpg_venues ON wpg_concerts.venue = wpg_venues.id ';
+
+ if ( $city ) {
+ $query .= 'WHERE wpg_venues.wpgvenue_city = ' . $wpdb->prepare('%s', $city);
+ }
$results = $wpdb->get_results($query);