From 144693a488a94979005710943b60316e924bf305 Mon Sep 17 00:00:00 2001 From: AndreaChirulescu Date: Sun, 18 Apr 2021 20:33:56 +0200 Subject: Added NN country for defaulting bands to an unknown country --- includes/admin/register_db_tables.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/admin/register_db_tables.php b/includes/admin/register_db_tables.php index 1121253..3e26a15 100644 --- a/includes/admin/register_db_tables.php +++ b/includes/admin/register_db_tables.php @@ -419,7 +419,12 @@ if ( !function_exists( "giglog_register_db_tables") ) `wpgcl_createddate` date NOT NULL DEFAULT current_timestamp();"); } - update_option("giglogadmin_db_version", 3); + if ($db_version == NULL || $db_version < 4) + { + $wpdb->query( + "INSERT INTO `wpg_countries` (`id`, `wpgc_fullname`, `wpgcountry_name`, `wpgc_iso3`, `wpgc_numcode`) VALUES ('NN', 'UNKNOWN', 'Unknown', 'NNN', '666');"); + } + update_option("giglogadmin_db_version", 4); } giglog_register_db_tables(); -- cgit v1.2.3 From 3746d5d7f20c169b2c5b1d94838305133770bd00 Mon Sep 17 00:00:00 2001 From: AndreaChirulescu Date: Mon, 19 Apr 2021 22:50:12 +0200 Subject: Added form fields and functionality for admin to edit assigned users --- includes/admin/views/giglog_admin_page.php | 35 ++++++++++++++++++++++++++++-- includes/concert.php | 23 ++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index b6fe098..9a59289 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -75,6 +75,30 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { return($select); } + static function get_user($cid, $ctype) + { + $hf_user = wp_get_current_user(); + $hf_username = $hf_user->user_login; + $select = ''; + return($select); + } + static function get_filters() { $cities = array_merge(["ALL"], GiglogAdmin_Venue::all_cities()); @@ -140,7 +164,12 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { .''.GiglogAdmin_AdminPage::get_allvenues($c->venue()).'
' .'
' .'
' - .'
'; + .'
' + .''.GiglogAdmin_AdminPage::get_user($c->id(),'photo1').'
' + .''.GiglogAdmin_AdminPage::get_user($c->id(),'photo2').'
' + .''.GiglogAdmin_AdminPage::get_user($c->id(),'rev1').'
' + .''.GiglogAdmin_AdminPage::get_user($c->id(),'rev2').'
' + ; // actions differ if we update or create a concert, hence two buttons needed if ($editing) { @@ -357,8 +386,10 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { else { GiglogAdmin_Concert::update_concert($_POST['pid'],$_POST['selectband'], $_POST['selectvenueadmin'], $_POST['cdate'], $_POST['ticket'], $_POST['eventurl']); - echo ''; + GiglogAdmin_Concert::update_concertlog($_POST['pid'],$_POST['photo1'], $_POST['photo2'], $_POST['rev1'], $_POST['rev2']); + echo ''; } + } if(isset($_POST['newband'])) diff --git a/includes/concert.php b/includes/concert.php index 7afedca..462586d 100644 --- a/includes/concert.php +++ b/includes/concert.php @@ -130,6 +130,29 @@ if ( !class_exists('GiglogAdmin_Concert') ) { return ($wpdb->last_error); } + static function update_concertlog($cid, $ph1, $ph2, $rev1, $rev2) + { + global $wpdb; + + $res = $wpdb->update('wpg_concertlogs', array( + 'wpgcl_photo1' => $ph1, + 'wpgcl_photo2' => $ph2, + 'wpgcl_rev1' => $rev1, + 'wpgcl_rev2' => $rev2 + ), + array('wpgcl_concertid' => $cid) + ); + + if ( !$res ) { + // exit( var_dump( $wpdb->last_query ) ); //for onscreen debugging when needed + error_log( __CLASS__ . '::' . __FUNCTION__ . ": {$wpdb->last_error}"); + die; + } + + return ($wpdb->last_error); + + } + public static function get($band, $venue, $date) { global $wpdb; -- cgit v1.2.3