So I was really wanting the ability to have my staff have "Admin" or "Mod" etc displayed in Private messages. For proof a member is a staff member, and not just a member claiming to be staff by having "- Lost Era Staff" or something in their message text. I wanted it to officially display in the PMs and after almost a whole day of struggling with different code, I finally got it to work and wanted to share.
So what this does is displays whatever you have in the database before the user's name in the PM. So where it says From: (Username here) it now says:
From:
Admin (Username here)
and inside it'll have a display bar under the "(user) sent you this PM" that lists what staff type they are.
First you want to a new column in users database called staffmail (or whatever you want to call it, but for simplicities sake I'll say staffmail since it's what I used)
and set it to VARCHAR 20 then submit. This is what you'll be changing for each individual use, manually inputting Admin, Mod, or whatever you want.
Next let's do the Message Inbox display. So open class_messagetablehelper.php and find the protected function getProfile($param){ section around line 35.
You're going to be replacing the return function with this:
$staffmail = $mysidia->db->select("users", array("staffmail"), "username ='{$param}'")->fetchColumn();
return new Comment("{$staffmail} <a href='profile/view/{$param}'>$nickname</a>");
My code looks like this:
That should take care of the Inbox view. Next is within the PM. So open class_privatemessage.php and around line 70 find public function getPostbar(){ section.
Add inside it above the PostHeader:
if($sender->staffmail == "Admin"){
$postHeader->add(new Comment("<p style='color: #000000; background-color: #4287f5;'>{$sender->staffmail}</p>"));
}
Mine looks like this:
and that's it
NOTE: I used uids and a nicknames for my user names and stuff so you need to leave that stuff out unless you add the nickname into your database. Uids should work though.
So what this does is displays whatever you have in the database before the user's name in the PM. So where it says From: (Username here) it now says:
From:
Admin (Username here)
and inside it'll have a display bar under the "(user) sent you this PM" that lists what staff type they are.
First you want to a new column in users database called staffmail (or whatever you want to call it, but for simplicities sake I'll say staffmail since it's what I used)
and set it to VARCHAR 20 then submit. This is what you'll be changing for each individual use, manually inputting Admin, Mod, or whatever you want.
Next let's do the Message Inbox display. So open class_messagetablehelper.php and find the protected function getProfile($param){ section around line 35.
You're going to be replacing the return function with this:
$staffmail = $mysidia->db->select("users", array("staffmail"), "username ='{$param}'")->fetchColumn();
return new Comment("{$staffmail} <a href='profile/view/{$param}'>$nickname</a>");
My code looks like this:
protected function getProfile($param){
$mysidia = Registry::get("mysidia");
$nickname = $mysidia->db->select("users", array("nickname"), "username ='{$param}'")->fetchColumn();
$uid = $mysidia->db->select("users", array("uid"), "username ='{$param}'")->fetchColumn();
if($param == "SYSTEM") return $param;
$staffmail = $mysidia->db->select("users", array("staffmail"), "username ='{$param}'")->fetchColumn();
return new Comment("{$staffmail} <a href='profile/view/{$param}'>$nickname</a>");
}
That should take care of the Inbox view. Next is within the PM. So open class_privatemessage.php and around line 70 find public function getPostbar(){ section.
Add inside it above the PostHeader:
if($sender->staffmail == "Admin"){
$postHeader->add(new Comment("<p style='color: #000000; background-color: #4287f5;'>{$sender->staffmail}</p>"));
}
Mine looks like this:
public function getPostbar(){
if($this->mid == 0) return FALSE;
$sender = new Member($this->fromuser);
$sender->getprofile();
$this->postbar = new Table("postbar", "100%", FALSE);
$postHeader = new TRow;
if($sender->staffmail == "Admin"){
$postHeader->add(new Comment("<p style='color: #000000; background-color: #4287f5;'>{$sender->staffmail}</p>"));
}
$postHeader->add(new TCell("<b>Employee Since: </b><br>{$sender->membersince}<br>"));
$this->postbar->add($postHeader);
return $this->postbar;
}
and that's it
NOTE: I used uids and a nicknames for my user names and stuff so you need to leave that stuff out unless you add the nickname into your database. Uids should work though.
Attachments
Last edited: