Commit ff4bf6c7 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Let staff users see proper names. Regenerate session id when the user

logs in
parent f919251f
......@@ -176,7 +176,6 @@ class Session {
$result = '<div id="messages">';
if (isset($_SESSION['messages'])) {
foreach ($_SESSION['messages'] as $data) {
// @todo probably should be done with MochiKit.Signal
$result .= '<div class="' . $data['type'] . '">';
$result .= '<div class="fr"><a href="" onclick="removeElement(this.parentNode.parentNode);return false;">';
$result .= '<img src="' . theme_get_url('images/icon_close.gif') . '" alt="[X]"></a></div>';
......@@ -194,7 +193,6 @@ class Session {
private function ensure_session() {
if (empty($_SESSION)) {
if (!session_id()) {
//session_start();
@session_start();
}
$_SESSION = array(
......
......@@ -168,6 +168,7 @@ class User {
* @param object $userdata Information to persist across page loads
*/
public function login($userdata) {
session_regenerate_id(true);
foreach (array_keys($this->defaults) as $key) {
$this->set($key, (isset($userdata->{$key})) ? $userdata->{$key} : $this->defaults[$key]);
}
......
......@@ -313,6 +313,7 @@ function display_name($user, $userto=null) {
$userto->firstname = $USER->get('firstname');
$userto->lastname = $USER->get('lastname');
$userto->admin = $USER->get('admin');
$userto->staff = $USER->get('staff');
}
if (is_array($user)) {
$user = (object)$user;
......@@ -333,11 +334,12 @@ function display_name($user, $userto=null) {
$user->firstname = $userObj->get('firstname');
$user->lastname = $userObj->get('lastname');
$user->admin = $userObj->get('admin');
$user->staff = $userObj->get('staff');
}
// if they don't have a preferred name set, just return here
if (empty($user->preferredname)) {
if ($userto->admin) {
if ($userto->admin || $userto->staff) {
return $user->firstname . ' ' . $user->lastname . ' (' . $user->username . ')';
}
return $user->firstname . ' ' . $user->lastname;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment