summaryrefslogtreecommitdiffstats
path: root/includes/concertlogs.php
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-05-25 21:02:42 +0200
committerHarald Eilertsen <haraldei@anduin.net>2021-05-25 21:02:42 +0200
commit7ef3a3cbbe723e7e56f47ed1c85ac39488815bfd (patch)
tree534ea197efc72eec207baaed6a0c9f6d083ba4f5 /includes/concertlogs.php
parent40fd00f9b5988690d09fb4f760577e54b51a9c5b (diff)
downloadgigologadmin-7ef3a3cbbe723e7e56f47ed1c85ac39488815bfd.tar.gz
gigologadmin-7ef3a3cbbe723e7e56f47ed1c85ac39488815bfd.tar.bz2
gigologadmin-7ef3a3cbbe723e7e56f47ed1c85ac39488815bfd.zip
Add method to get assigned user for concertlogs
Diffstat (limited to 'includes/concertlogs.php')
-rw-r--r--includes/concertlogs.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/includes/concertlogs.php b/includes/concertlogs.php
index 9546d21..583cc8d 100644
--- a/includes/concertlogs.php
+++ b/includes/concertlogs.php
@@ -37,5 +37,25 @@ if ( !class_exists( 'GiglogAdmin_Concertlogs' ) )
return $res ? $res[0]->wpgcl_status : null;
}
+
+ public static function get_assigned_user( int $concert_id, string $role ) : ?string
+ {
+ global $wpdb;
+
+ if ( ! in_array( $role, [ 'photo1', 'photo2', 'rev1', 'rev2' ] ) ) {
+ error_log(__METHOD__ . ": invalid \$role ({$role}) given.");
+ return null;
+ }
+
+ $column = "wpgcl_{$role}";
+ $q = $wpdb->prepare(
+ "select {$column} from wpg_concertlogs where id = %d",
+ $concert_id);
+
+ $res = $wpdb->get_row($q, ARRAY_A);
+ var_dump($res);
+
+ return array_shift( $res );
+ }
}
}