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

Welcome message

This forum is now locked as we will no longer be developing the v1.x branch

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

Topic locked
14 posts • Page 1 of 1

Postby HeroicLife » Tue Feb 21, 2006 11:42 pm

How about a welcome message that a user sees when he joins (but not the whole chat room)
HeroicLife
Member
 
Posts: 17
Joined: Tue Feb 21, 2006 8:55 pm
Top

Postby Djamoer » Wed Feb 22, 2006 1:44 am

Sounds like a IRC channel topic. I would love to see this features as well.
Djamoer
Member
 
Posts: 29
Joined: Sun Feb 12, 2006 12:06 pm
Top

Postby Nemako » Wed Feb 22, 2006 9:32 am

yep that's a good idea. I think it has already been request but I don't know if kerphi notice it :)
Nemako
Nemako
Member
 
Posts: 44
Joined: Fri Feb 10, 2006 1:52 pm
  • Website
Top

Postby Rhialto » Fri Apr 28, 2006 6:21 am

Glad I used the search... I was coming here to ask for this. :-)

Anyway to implement it in 0.9.2? I tried to look to insert it before history messages are displayed but since I'm not a pro, I work with tries and errors so maybe someone better that me can easily add that.

I thought about a simple $welcome = 'welcome message heren2nd line herenbbcode works too!' then a call to show the message. There is no need to display the date/hour before it but if easier to simply call an existing function that also output date/hours based on $params["clock"] then I don't mind.

Anyone? :-)
Last edited by Rhialto on Fri Apr 28, 2006 6:22 am, edited 1 time in total.
Rhialto
Member
 
Posts: 30
Joined: Sat Apr 15, 2006 7:40 am
Location: Canada
Top

Postby Rhialto » Sun Apr 30, 2006 3:57 pm

Instead of $welcome = "msg" it may be easier to use a file instead. I know how I could do it with "echo" but that won't throw it in the scrollable area. What function to call so it is displayed in thechat box and will scroll but won't be placed into the history file?
Rhialto
Member
 
Posts: 30
Joined: Sat Apr 15, 2006 7:40 am
Location: Canada
Top

Postby Mgccl » Sun Apr 30, 2006 6:00 pm

I was thinking about it too... the welcome message.... so I thought maybe I just make an welcome message as an pupout DIV and show, when user start to type things, it disappear
Mgccl
Member
 
Posts: 35
Joined: Sun Apr 16, 2006 9:40 pm
Top

Postby Yokhannan » Sun Oct 22, 2006 2:08 pm

Well, there is an easy way to deal with this... but it's got one little bug I can't figure out why the hell it happens....

Inside of (src/commands/join.class.php) find :

// register the user (and his metadata) in the channel

before that add:

Code: Select all
//
// show a welcome message
// yokhannan <yokhannan@gmail.com>
//
unset($cmdp);
$cmdp["param"] = str_replace('_', '', _pfc("%s, welcome to our chatroom!",$u->nick, $channame));
$cmdp["recipient"] = $chanrecip;
$cmdp["recipientid"] = $chanid;
$cmdp["flag"] = 2;
$cmd =& pfcCommand::Factory("notice");
$cmd->run($xml_reponse, $cmdp);

Ok... now the bug.... for some reason I have yet to understand the script author does the following inside of the _pfc() function
Code: Select all
"_".$args[0]."_"

No where in the code can I find exactly why he has done this... so (to me and this bit of code)... it's a bug. ;) (perhaps he can explain??)

The fix to this was to do something that is not exactly good php practice... and that is to str_replace() on a core function.

But, none-the-less... this works. (for me at least)

Yokhannan
Yokhannan
Member
 
Posts: 18
Joined: Sun Oct 22, 2006 12:50 pm
  • Website
Top

Postby phpfreechat » Sun Oct 22, 2006 5:34 pm

Yokhannan wrote:No where in the code can I find exactly why he has done this... so (to me and this bit of code)... it's a bug. ;) (perhaps he can explain??)

Hi Yokhannan,

Yes I can explain. _pfc(...) function is used to translate all the chat strings.
These translations are located in i18n/xx_XX/main.php files (replace xx_XX by your local).
When _pfc(...) doesn't find any translations for the label, then it just append and prepend the '_' characteres to the string. So it's easier to find what has not been translated :)

regards,

Kerphi.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby Yokhannan » Mon Oct 23, 2006 1:07 am

kerphi wrote:Yes I can explain. _pfc(...) function is used to translate all the chat strings.
These translations are located in i18n/xx_XX/main.php files (replace xx_XX by your local).
When _pfc(...) doesn't find any translations for the label, then it just append and prepend the '_' characteres to the string. So it's easier to find what has not been translated :)

D'Oh!!!! Crap, I should have figured that one out... Yeah, I understand that function now. Thanks for pointing this out.


Ok, folks, do this than:

Code: Select all
OPEN:
/src/commands/join.class.php

FIND:
// register the user (and his metadata) in the channel


BEFORE, ADD:

//
// show a welcome message
// yokhannan <yokhannan@gmail.com>
//
unset($cmdp);
$cmdp["param"] = _pfc("%s, welcome to our chatroom!",$u->nick, $channame);
$cmdp["recipient"] = $chanrecip;
$cmdp["recipientid"] = $chanid;
$cmdp["flag"] = 2;
$cmd =& pfcCommand::Factory("notice");
$cmd->run($xml_reponse, $cmdp);


OPEN:

18n/xx_XX/main.php files (replace xx_XX by your local)


FIND:

?>

BEFORE, ADD:

// line 62 in join.class.php
$GLOBALS["i18n"]["%s, welcome to our chatroom!"] = "%s, welcome to our chatroom!";

And, that will give you a nice little "welcome message" to everybody who joins your chat room.

Thanks again for the clarification Kerphi.
Yokhannan
Member
 
Posts: 18
Joined: Sun Oct 22, 2006 12:50 pm
  • Website
Top

Postby moreins » Mon Dec 18, 2006 7:33 am

hello
the code is working for me but im getting the message twice...one under the other1...
can any1 help me?
moreins
New member
 
Posts: 3
Joined: Sun Dec 17, 2006 9:53 pm
Top

Postby zilveer » Tue Dec 19, 2006 2:40 pm

Anyhow..
a topic which is shown when you enter the channel would be great:)
/Isa Acar, the truth is infront of you
zilveer
Member
 
Posts: 38
Joined: Sat Oct 07, 2006 11:35 am
Top

Postby theworld » Sun Dec 31, 2006 12:22 am

moreins wrote:hello
the code is working for me but im getting the message twice...one under the other1...
can any1 help me?

Yes, you have placed the code outside of the if condition. So it gets executed every time, and you receive multiple displays. In the join.class.php file where you entered the code, look for
if(!isset($u->channels[$chanid]))

The welcome code must be placed before the closing bracket of that condition. You will probably find the closing bracket right before your new code. Simply move it after the code.

And, thank you Yokhannan for the mod.

Cheers
Last edited by theworld on Sun Dec 31, 2006 12:26 am, edited 1 time in total.
theworld
Member
 
Posts: 10
Joined: Wed Dec 27, 2006 12:54 am
Top

Postby zilveer » Wed Feb 07, 2007 4:36 pm

Why not have this implemented in beta9 av phpfreechat?
/Isa Acar, the truth is infront of you
zilveer
Member
 
Posts: 38
Joined: Sat Oct 07, 2006 11:35 am
Top

Postby zooky » Sat Feb 10, 2007 9:21 pm

where is the beta 9? there is no formal publishment :S
zooky
Member
 
Posts: 60
Joined: Wed Sep 13, 2006 9:09 am
Top


Topic locked
14 posts • Page 1 of 1

Return to Feature Requests (v1.x)

Who is online

Users browsing this forum: No registered users and 0 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