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

Custom parameters

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

Post a reply
9 posts • Page 1 of 1

Postby kriko » Tue Sep 21, 2010 7:16 am

I would like to customize my chat, so it displays multiple status icons in user list - for e.g. if a user have an anniversary, birthday...
I know how to do that in customize.js.php - I had an idea about getting it via an extra parameter:
Code: Select all
var isBday = this.getUserMeta(nickid, 'isBday');

However this will not work, since adding such parameter will prevent chat from initializing - it doesn't digest other custom parameters. Is there a way around this or a better way to pass parameters across?
kriko
Member
 
Posts: 30
Joined: Sun May 31, 2009 8:07 pm
Top

Postby OldWolf » Tue Sep 21, 2010 9:34 am

Add it as a parameter rather than a var in the class, on the chat page.
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby kriko » Tue Sep 21, 2010 10:54 am

Can you elaborate a bit more?
My idea was that I have preinitialization script, which determines if a board user has birthday or registration anniversary prior loading chat and respectively set vars (isBday, isAnniversary) so I can display aditional icons by customizing customize.js.php (pfcClient.prototype.buildNickItem).

I didn't understand the part of adding parameters, do you have a piece of code or a demo to show me how?
What I did in main class is this:
Code: Select all
$params["isBday"] = determineBday($user_id);

Thanks!
Last edited by kriko on Tue Sep 21, 2010 10:54 am, edited 1 time in total.
kriko
Member
 
Posts: 30
Joined: Sun May 31, 2009 8:07 pm
Top

Postby OldWolf » Tue Sep 21, 2010 6:24 pm

Well, in your example above (first post), it looks like you were messing with the global config class, which you don't want to do. Instead, you should be setting parameters (your second example) in the chat page, whatever it might be called (by default, that's index.php).
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby kriko » Tue Sep 21, 2010 6:35 pm

$params["isBday"] = determineBday($user_id);

Well If I do that, then chat it won't load at all - it says that I should review my parameters, since "bday" is invalid.
And such parameters is possible to retrieve as in first post, I already use that for "isadmin", in that case I load a special icon next to nick name.

So examples in my first and second post are compatible, one is from php script, the other is from customized overriden js method which should be able to get "special" parameters.

I'm not sure if this is even possible.... but it would be great
kriko
Member
 
Posts: 30
Joined: Sun May 31, 2009 8:07 pm
Top

Postby OldWolf » Wed Sep 22, 2010 12:21 am

Ah, it looked like that first post was out of the global configs class.

Well isBday isn't a valid parameter... so that makes sense. But, as you were looking at with your first post, you would use nick meta.

$params['nickmeta'] = array('isBday' => determineBday($user_id));
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby kriko » Wed Sep 22, 2010 3:56 am

Offcourse, now I remember! It works, just a tiny problem.
I've added to images subdir (inside theme) some more icons, but it seems like chat script cannot find them, e.g.:
Code: Select all
 if (isBday)
 {
   var img = document.createElement('img');
   img.setAttribute('src', this.res.getFileUrl('images/cake.png'));
   img.setAttribute(className, 'pfc_nickbutton');
   a.appendChild(img);
 }

This works, if I load a previously added rainbow.png, however it fails when trying to load cake.png (src of image is empty). All those files do exist, I did rehashed the settings, is there something else I should do?

UPDATE: forcing whole path as string without getFileUrl works. I've deleted themes from public folder, deleted cache folder, dropped table and let script regenerate. It will copy the custom icons over to public folder in respective theme, but getFileUrl still fails.
Last edited by kriko on Wed Sep 22, 2010 4:15 am, edited 1 time in total.
kriko
Member
 
Posts: 30
Joined: Sun May 31, 2009 8:07 pm
Top

Postby re*s.t.a.r.s.*2 » Wed Sep 22, 2010 2:59 pm

yeah , I tried too and also failed on me putting the path helped..
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby kriko » Thu Sep 30, 2010 12:08 pm

I got it - you need to put the new resource file into:
phpfreechat.class.php
kriko
Member
 
Posts: 30
Joined: Sun May 31, 2009 8:07 pm
Top


Post a reply
9 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 21 guests

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