so here is the command:
/bday usernick
it is only available to admin and created by copying the /op command
put this file[bday.class.php] into srccommands directory
- Code: Select all
<?php
require_once(dirname(__FILE__)."/../pfccommand.class.php");
class pfcCommand_bday extends pfcCommand
{
var $usage = "/bday {nickname}";
function run(&$xml_reponse, $p)
{
$clientid = $p["clientid"];
$param = $p["param"];
$sender = $p["sender"];
$recipient = $p["recipient"];
$recipientid = $p["recipientid"];
$c =& pfcGlobalConfig::Instance();
$u =& pfcUserConfig::Instance();
$ct =& pfcContainer::Instance();
if (trim($param) == "")
{
// error
$cmdp = $p;
$cmdp["param"] = _pfc("Missing parameter");
$cmdp["param"] .= " (".$this->usage.")";
$cmd =& pfcCommand::Factory("error");
$cmd->run($xml_reponse, $cmdp);
return;
}
$isadmin = $ct->getUserMeta($u->nickid, 'isadmin');
if (!$isadmin)
{
$cmdp = $p;
$cmdp["param"] = _pfc("Must be an Admin");
$cmd =& pfcCommand::Factory("error");
$cmd->run($xml_reponse, $cmdp);
return;
}
// just change the "isbday" meta flag
$nicktoop = trim($param);
$nicktoopid = $ct->getNickId($nicktoop);
$ct->setUserMeta($nicktoopid, 'isbday', true);
$this->forceWhoisReload($nicktoopid);
}
}
?>
Now, make the following changes in data/public/js/pfcclient.js file.
line: 339 where it says
- Code: Select all
if (resp == "ok" || resp == "notchanged" || resp == "changed" || resp == "connected")
{
this.setUserMeta(this.nickid, 'nick', param);
this.el_handle.innerHTML = this.getUserMeta(this.nickid, 'nick').escapeHTML();
this.nickname = this.getUserMeta(this.nickid, 'nick');
this.updateNickBox(this.nickid);
// clear the possible error box generated by the bellow displayMsg(...) function
this.clearError(Array(this.el_words));
}
change it to
- Code: Select all
if (resp == "ok" || resp == "notchanged" || resp == "changed" || resp == "connected")
{
if(resp=="connected")
{
this.setUserMeta(this.nickid, 'isbday', false);
}
this.setUserMeta(this.nickid, 'nick', param);
this.el_handle.innerHTML = this.getUserMeta(this.nickid, 'nick').escapeHTML();
this.nickname = this.getUserMeta(this.nickid, 'nick');
this.updateNickBox(this.nickid);
// clear the possible error box generated by the bellow displayMsg(...) function
this.clearError(Array(this.el_words));
}
line: 1404 where it says
- Code: Select all
var isadmin = this.getUserMeta(nickid, 'isadmin');
if (isadmin == '') isadmin = false;
Change it to
- Code: Select all
var isadmin = this.getUserMeta(nickid, 'isadmin');
var isbday = this.getUserMeta(nickid, 'isbday');
if (isadmin == '') isadmin = false;
if (isbday == '') isbday = false;
Several lines later at line:1428 where it says
- Code: Select all
if (isadmin)
img.setAttribute('src', this.res.getFileUrl('images/user-admin.gif'));
else
img.setAttribute('src', this.res.getFileUrl('images/user.gif'));
Change it to
- Code: Select all
if (isadmin)
img.setAttribute('src', this.res.getFileUrl('images/user-admin.gif'));
else if (isbday)
img.setAttribute('src', this.res.getFileUrl('images/user-bday.gif'));
else
img.setAttribute('src', this.res.getFileUrl('images/user.gif'));
Now, in the srcphpfreechat.class.php file
add the new resource in the following way
- Code: Select all
'images/close-whoisbox.gif',
'images/openpv.gif',
'images/user-admin.gif',
'images/user-bday.gif',
'images/sound-on.gif',
'images/sound-off.gif',
'sound.swf',
'images/close-whoisbox.gif',
'images/openpv.gif',
'images/user-admin.gif',
'images/user-bday.gif',
'images/sound-on.gif',
'images/sound-off.gif',
'sound.swf',
The resource is highlighted in bold letters.
Finally, create a 16x16 pixel gif image as the birthday icon.
Thats it.