• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

The \"Bday\" or birthday command to change the icon of a use

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
4 posts • Page 1 of 1

Postby skchandon » Thu Dec 03, 2009 9:46 am

This command changes the icon of a particular user from regular user icon to a specail icon indicating that its his/her birthday.
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.
Last edited by skchandon on Thu Dec 03, 2009 10:04 am, edited 1 time in total.
skchandon
New member
 
Posts: 6
Joined: Sat Aug 08, 2009 12:10 am
Top

Postby DreadPirateVane » Sun Sep 19, 2010 4:38 pm

unfortunately this does not work for version 1.3 is too bad as my chatters really liked this option.

I have tried several different variations to get it to work,, and it seems to just remove the online Nick list and blanks out the chat,, can still see all the chatting, if any is active,, but no nick names. hopefully you may be able to fix this issue.
Station Built by the Bands,, For the Fans!!
DreadPirateVane
Member
 
Posts: 47
Joined: Tue Dec 23, 2008 10:44 pm
Location: Kansas City, Mo.
  • Website
  • YIM
Top

Postby guttastyle » Mon Mar 05, 2012 6:05 pm

Hello , i am using version 1.3 and the same thing happen to me. It a shame because i really liked this feature, i hope it gets addressed and fixed to work on version 1.3 makes me feel like downgrading just so i can use this feature
guttastyle
Member
 
Posts: 24
Joined: Sat Mar 03, 2012 5:37 pm
Top

Postby guttastyle » Wed Mar 07, 2012 9:48 pm

Hello skchandon, exactly which version of PFC did this work for you with ?
guttastyle
Member
 
Posts: 24
Joined: Sat Mar 03, 2012 5:37 pm
Top


Post a reply
4 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 18 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub