FreiChat related discussions
Username Fix

What is the steps and script used to change the account holder name to the username in the messenger and chatroom areas?

What is the steps and script used to change the account holder name to the username in the messenger and chatroom areas?

open freichat/server/drivers/Elgg.php

and search for "SELECT username FROM"

and change it to "SELECT name FROM"

open freichat/server/drivers/Elgg.php and search for "SELECT username FROM" and change it to "SELECT name FROM"
Necessity is the mother of all inventions!

I did what you suggested and I couldn't produce the desired result from it. The change you can see is about the eleventh line down on the script I pasted in the message. Here is what the script looks like:
----------------------------------------------------------------------------------------------------------------------

public function getDBdata($session_id, $first) {
if ($session_id == 0) {
$_SESSION[$this->uid . 'is_guest'] = 1;
} else {
$_SESSION[$this->uid . 'is_guest'] = 0;
}
if ($_SESSION[$this->uid . 'is_guest'] == 0) {
if ($_SESSION[$this->uid . 'time'] online_time || isset($_SESSION[$this->uid . 'usr_name']) == false || $first == 'false') { //To consume less resources , now the query is made only once in 15 seconds
$query = "SELECT name FROM " . DBprefix . "users_entity WHERE guid='" . $session_id . "' LIMIT 1";
$res_obj = $this->db->query($query);
$res = $res_obj->fetchAll();

if ($res == null) {
$this->freichat_debug("Incorrect Query : " . $query . ", check parameters");
}
foreach ($res as $result) {
if (isset($result['username'])) { //To avoid undefined index error. Because empty results were shown sometimes
$_SESSION[$this->uid . 'usr_name'] = $result['usr_name'];
$_SESSION[$this->uid . 'usr_ses_id'] = $session_id;
}
}
}
} else {
$_SESSION[$this->uid . 'usr_name'] = $_SESSION[$this->uid . 'gst_nam'];
$_SESSION[$this->uid . 'usr_ses_id'] = $_SESSION[$this->uid . 'gst_ses_id'];
}
}

----------------------------------------------------------------------------------------------------------------------

Am I missing any other changes?

I did what you suggested and I couldn't produce the desired result from it. The change you can see is about the eleventh line down on the script I pasted in the message. Here is what the script looks like: ---------------------------------------------------------------------------------------------------------------------- <code> public function getDBdata($session_id, $first) { if ($session_id == 0) { $_SESSION[$this->uid . 'is_guest'] = 1; } else { $_SESSION[$this->uid . 'is_guest'] = 0; } if ($_SESSION[$this->uid . 'is_guest'] == 0) { if ($_SESSION[$this->uid . 'time'] < $this->online_time || isset($_SESSION[$this->uid . 'usr_name']) == false || $first == 'false') { //To consume less resources , now the query is made only once in 15 seconds $query = "SELECT name FROM " . DBprefix . "users_entity WHERE guid='" . $session_id . "' LIMIT 1"; $res_obj = $this->db->query($query); $res = $res_obj->fetchAll(); if ($res == null) { $this->freichat_debug("Incorrect Query : " . $query . ", check parameters"); } foreach ($res as $result) { if (isset($result['username'])) { //To avoid undefined index error. Because empty results were shown sometimes $_SESSION[$this->uid . 'usr_name'] = $result['usr_name']; $_SESSION[$this->uid . 'usr_ses_id'] = $session_id; } } } } else { $_SESSION[$this->uid . 'usr_name'] = $_SESSION[$this->uid . 'gst_nam']; $_SESSION[$this->uid . 'usr_ses_id'] = $_SESSION[$this->uid . 'gst_ses_id']; } } </code> ---------------------------------------------------------------------------------------------------------------------- Am I missing any other changes?

By default , FreiChat fetches the usernames . If you did not get the desired result by changing
the query , then what exactly did you get ?

By default , FreiChat fetches the usernames . If you did not get the desired result by changing the query , then what exactly did you get ?
Necessity is the mother of all inventions!

Meaning, I want it to fetch the Display name, not the Username.

Meaning, I want it to fetch the Display name, not the Username.

What I ended up with was the fetching or loading user data freeze

What I ended up with was the fetching or loading user data freeze

Display Names(Nicknames) can now be seen in chat and messenger boxes. It has been fixed thanks to the Envix crew.

This fix made it possible to view a users Display name(or nickname) rather than the username(account name) in the messenger and chatbox. Great software/application! Thanks for the help!

Display Names(Nicknames) can now be seen in chat and messenger boxes. It has been fixed thanks to the Envix crew. This fix made it possible to view a users Display name(or nickname) rather than the username(account name) in the messenger and chatbox. Great software/application! Thanks for the help!
97
6
0
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft