summaryrefslogtreecommitdiffstats
path: root/includes/concert.php
diff options
context:
space:
mode:
authorAndreaChirulescu <andrea.chirulescu@gmail.com>2021-09-04 20:48:34 +0200
committerAndreaChirulescu <andrea.chirulescu@gmail.com>2021-09-04 20:48:34 +0200
commitdf6eca59b3a6c33f6135f26a21dfa179ee1414e2 (patch)
tree75e30f91fc50e1a04da820253bc32f56a7fda9ee /includes/concert.php
parent33434e85d498b9a8b0bd6731288659682f692057 (diff)
parent38bfa49958eca679166231f46e767f229d2561a6 (diff)
downloadgigologadmin-df6eca59b3a6c33f6135f26a21dfa179ee1414e2.tar.gz
gigologadmin-df6eca59b3a6c33f6135f26a21dfa179ee1414e2.tar.bz2
gigologadmin-df6eca59b3a6c33f6135f26a21dfa179ee1414e2.zip
Merge branch 'dev' of https://code.volse.net/wordpress/plugins/gigologadmin.git into andreaschanges
Diffstat (limited to 'includes/concert.php')
-rw-r--r--includes/concert.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/includes/concert.php b/includes/concert.php
index c0c13ee..a533679 100644
--- a/includes/concert.php
+++ b/includes/concert.php
@@ -30,6 +30,12 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
public const STATUS_ALL_APPROVED = 4;
public const STATUS_REJECTED = 5;
+ private const BASE_QUERY =
+ 'SELECT wpg_concerts.*, wpg_venues.id as venue_id, wpg_venues.wpgvenue_name wpg_venues_wpgvenue_city '
+ . 'FROM wpg_concerts '
+ . 'LEFT JOIN wpg_venues ON wpg_concerts.venue = wpg_venues.id ';
+
+
/*
* Constructs a new concert object from an array of attributes.
* The attributes are expected to be named as in the database,
@@ -67,7 +73,6 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
}
}
-
/**
* Get concert with given id.
*
@@ -78,8 +83,7 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
{
global $wpdb;
- $query = 'SELECT * FROM wpg_concerts '
- . 'LEFT JOIN wpg_venues ON wpg_concerts.venue = wpg_venues.id '
+ $query = self::BASE_QUERY
. 'WHERE ' . $wpdb->prepare('wpg_concerts.id = %d', $id);
$results = $wpdb->get_results($query);
@@ -200,8 +204,7 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
{
global $wpdb;
- $query = 'SELECT * FROM wpg_concerts '
- . 'INNER JOIN wpg_venues ON wpg_concerts.venue = wpg_venues.id ';
+ $query = self::BASE_QUERY;
$where = [];