From 19c28b2d51c68d51802b4a653d289a88a00b5d87 Mon Sep 17 00:00:00 2001 From: AndreaChirulescu Date: Sun, 25 Apr 2021 19:44:01 +0200 Subject: removed older icons. Added new ones created by me Modified returnuser function to not allow a user to assign multiple slots to themselves --- includes/admin/views/giglog_admin_page.php | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'includes/admin/views/giglog_admin_page.php') diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index 3336fbd..72a34eb 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -422,22 +422,19 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { if (!empty($c)) { - - $vquery0 = "select wpgcl_".$p1." as assigneduser from wpg_concertlogs where wpgcl_concertid=".$c ; - $results = $wpdb->get_results($vquery0); - - foreach ( $results AS $row ) { - $x= $row -> assigneduser; - if ($x !='' and $x!=$hf_username) return ('Taken
Taken by '.$x.'
'); - else - if ($x==$hf_username) //if current user - return ('
-
'); - else //not taken by anyone - return ('
-
'); - - } + $sql = "select * from wpg_concertlogs where wpgcl_concertid=".$c; + $crow = $wpdb->get_results($sql); + $array = array('photo1' => $crow[0]->wpgcl_photo1, 'photo2'=> $crow[0]->wpgcl_photo2, 'rev1' => $crow[0]->wpgcl_rev1, 'rev2'=> $crow[0]->wpgcl_rev2); + + //first check if current slot is taken by current user + if ($array[$p1] == $hf_username) return ('
'); + else //check if slot is taken by another user + if (!empty($array[$p1])) return ('Taken
Taken by '.$array[$p1].'
'); + else //check if other slots for this concert are taken by user + if (in_array($hf_username,$array)) return ('-'); + else //not taken by anyone + return ('
+
'); } else return ('no concert selected'); -- cgit v1.2.3