summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-05-25 21:03:24 +0200
committerHarald Eilertsen <haraldei@anduin.net>2021-05-25 21:03:24 +0200
commitaaa154aec8b446fb7123f0dd7a37bdd18490248e (patch)
tree4f12655c19c123466a70229599c8671a0981140b
parent7ef3a3cbbe723e7e56f47ed1c85ac39488815bfd (diff)
downloadgigologadmin-aaa154aec8b446fb7123f0dd7a37bdd18490248e.tar.gz
gigologadmin-aaa154aec8b446fb7123f0dd7a37bdd18490248e.tar.bz2
gigologadmin-aaa154aec8b446fb7123f0dd7a37bdd18490248e.zip
Simplify AdminPage::get_user
Now queries the user from the concertlogs table instead of going by generating a form that is thrown away.
-rw-r--r--includes/admin/views/giglog_admin_page.php19
1 files changed, 5 insertions, 14 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php
index 7ae7628..4f211fc 100644
--- a/includes/admin/views/giglog_admin_page.php
+++ b/includes/admin/views/giglog_admin_page.php
@@ -53,29 +53,20 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
fn($usr) => $usr->user_login,
get_users( array( 'fields' => array( 'user_login' ) ) ) );
- // This renders a user form, which we don't really use for anything
- // other than to check which user (if any) the form was made for.
- // Seems this could be done a bit simpler...
- $userform = GiglogAdmin_AdminPage::returnuser($ctype, $cid);
+ $current_user = $cid ? GiglogAdmin_Concertlogs::get_assigned_user( $cid, $ctype ) : null;
$select = '<select name="'.$ctype.'">';
$select .= '<option value="">Please Select..</option>';
foreach ( $users as $user ) {
- $taken = strpos($userform, $user); // != false if form contains $user
- if($taken) {
+ if ( $user == $current_user ) {
$select .= '<option value="' .$user. '" selected="selected">'.$user;
}
else {
- $takenbyself = strpos($userform, 'name="unassignitem"'); // != false if form is an unassign form
- if($takenbyself && $user == $hf_username) {
- $select .= '<option value="' .$user. '" selected="selected">'.$user;
- }
- else {
- $select .= '<option value="'.$user. '">'. $user;
- }
- $select .='</option>';
+ $select .= '<option value="'.$user. '">'. $user;
}
+
+ $select .='</option>';
}
$select .= '</select>';
return($select);