diff --git a/core/users/users.php b/core/users/users.php index 248e977ec8..cc5867f81a 100644 --- a/core/users/users.php +++ b/core/users/users.php @@ -50,6 +50,21 @@ $users = $_POST['users']; } +//check to see if contact details are in the view + $sql = "select * from view_users "; + $sql .= "where domain_uuid = :domain_uuid "; + $parameters = null; + $database = new database; + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + $row = $database->select($sql, $parameters, 'row'); + if (isset($row['contact_organization'])) { + $show_contact_fields = true; + } + else { + $show_contact_fields = false; + } + unset($parameters); + //process the http post data by action if ($action != '' && is_array($users) && @sizeof($users) != 0) { switch ($action) { @@ -130,7 +145,10 @@ //get the list $sql = "select domain_name, domain_uuid, user_uuid, username, group_names, "; - $sql .= "contact_organization,contact_name, cast(user_enabled as text) "; + if ($show_contact_fields) { + $sql .= "contact_organization,contact_name, "; + } + $sql .= "cast(user_enabled as text) "; $sql .= "from view_users "; if ($_GET['show'] == "all" && permission_exists('user_all')) { if (isset($sql_search)) { @@ -234,8 +252,10 @@ } echo th_order_by('username', $text['label-username'], $order_by, $order, null, null, $param); echo th_order_by('group_names', $text['label-groups'], $order_by, $order, null, null, $param); - echo th_order_by('contact_organization', $text['label-organization'], $order_by, $order, null, null, $param); - echo th_order_by('contact_name', $text['label-name'], $order_by, $order, null, null, $param); + if ($show_contact_fields) { + echo th_order_by('contact_organization', $text['label-organization'], $order_by, $order, null, null, $param); + echo th_order_by('contact_name', $text['label-name'], $order_by, $order, null, null, $param); + } //echo th_order_by('contact_name_family', $text['label-contact_name_family'], $order_by, $order); //echo th_order_by('user_status', $text['label-user_status'], $order_by, $order); //echo th_order_by('add_date', $text['label-add_date'], $order_by, $order); @@ -270,8 +290,10 @@ } echo " \n"; echo "