11
setaside
Re: 3rd party chat advice needed
  • 2003/10/7 1:12

  • setaside

  • Just popping in

  • Posts: 28

  • Since: 2002/9/24


Would you be willing to release that "Who's in Chat" block that you made for it?

The users of my site, as well as myself, aren't all that happy with the functionality of the latest beta release of Xoopschat, so I'm thinking of purchasing FlashChat until Xoopschat improves.

(Oh, and I don't want anyone to interpret that as me dissing the module, it's just not right for my needs right now.)

12
Coreace
Re: 3rd party chat advice needed
  • 2003/10/7 12:43

  • Coreace

  • Just popping in

  • Posts: 16

  • Since: 2003/8/26


I really liked the WebChat module, I am surprised this has not been updated to the Xoops2 system. After trying out 7 or so chat programs, WebChat still remains high on my list.

13
Draven
Re: 3rd party chat advice needed
  • 2003/10/7 13:06

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28


Quote:

setaside wrote:
Would you be willing to release that "Who's in Chat" block that you made for it?


The block function
Quote:
function b_inchat_show() {
global $xoopsDB,$xoopsUser;

$block = array();

$result = $xoopsDB->query("SELECT c.name AS name, d.uid AS uid FROM chat_users c, ".$xoopsDB->prefix("users")." d WHERE NOW( ) - datetime < 12 AND d.uname LIKE c.name");


while ( $myrow = $xoopsDB->fetchArray($result) ) {
$block['users'][] = $myrow;
}
$block["count"] = count($block['users']);
return $block;
}{


The template.
Quote:
<table width="99%" class="whitebg" border="0" cellspacing="1" cellpadding="3">
<tr>
<td class="odd"><b><{$block.count}></b> user(s) are in chat</td>
</tr>
<{if $block.users}>
<tr>
<td class="even">
<{foreach from=$block.users item=user}>
<a href="<{$XOOPS_URL}>userinfo.php?uid=<{$user.uid}>"><{$user.name}></a>,
<{/foreach}>
</td>
</tr>
<{/if}>
<tr>
<td class="odd">
<a href="<{$XOOPS_URL}>/modules/flashchat/">Join Chat Room Now!</a>
</td>
</tr>
</table>

14
DobePhat
Re: 3rd party chat advice needed
  • 2003/10/7 19:12

  • DobePhat

  • Friend of XOOPS

  • Posts: 656

  • Since: 2003/4/15


DRAVEN,

Wow thanks for that! Do you place in a custom block then modify a template or creat a new template file for it with the theme?

Also, did you run the install.php script that was included with the package? Or did you do it manually (can't decide)

Thanks again,
You've been a great help...

15
Draven
Re: 3rd party chat advice needed
  • 2003/10/7 20:03

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28


Quote:

DobePhat wrote:
Wow thanks for that! Do you place in a custom block then modify a template or creat a new template file for it with the theme?


No, it's made as a real block. Put the php file in a folder called "blocks" and name it inchat.php. Put the template file in the template/blocks/ folder (If I remeber you have to create the blocks folder inside templates) and name it "inchat.html".

Then add the follwing to the xoops_version file:

Quote:

// blocks
$modversion['blocks'][1]['file'] = "inchat.php";
$modversion['blocks'][1]['name'] = "Who's in chat";
$modversion['blocks'][1]['description'] = "Shows Article menu";
$modversion['blocks'][1]['show_func'] = "b_inchat_show";
$modversion['blocks'][1]['template'] = 'inchat.html';


Reload the module and you should be fine.

As for the install, I just did it the way the instructions say to. I haven't made it so the SQL is installed by the xoops_version yet. Didn't see a point since I can't distribute the chat to anyone. Sorry.

16
DobePhat
Re: 3rd party chat advice needed
  • 2003/10/9 14:30

  • DobePhat

  • Friend of XOOPS

  • Posts: 656

  • Since: 2003/4/15


Draven,
First of all thanks for this!

I have a problem though, I cant seem to recognizeinchat.html as a template?! It shows up but when I try to generate it (in template admin) it says it does not exist.

when I choose to display block (at least it gives me that option too!) it displays the php script above the header...
Im a little confused...did I did something wrong?

I updated the module and everything.hmmmmm
cache maybe?
I dunno...any advice is much appreciated. Thanks a lot this is great.

__OH I just checked it out...PHP Block (mine) is incorrect...I just pu in your function into a blank file and named it inchat.php...but perhaps you didn't mean to use that code only, am I missing something?>

17
Draven
Re: 3rd party chat advice needed
  • 2003/10/9 16:10

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28


Well did you enclose the function in <?php and ?> tags? If not, that would explain why the code is being printed to the screen. The exact file lloks like this.

Quote:
<?php
function b_inchat_show() {
global $xoopsDB,$xoopsUser;

$block = array();

$result = $xoopsDB->query("SELECT c.name AS name, d.uid AS uid FROM chat_users c, ".$xoopsDB->prefix("users")." d WHERE NOW( ) - datetime < 12 AND d.uname LIKE c.name");


while ( $myrow = $xoopsDB->fetchArray($result) ) {
$block['users'][] = $myrow;
}
$block["count"] = count($block['users']);
return $block;
}

?>



As for the template, did you create the inchat.html file in flashchat/templates/blocks folder? it needs to be there. Usually when it shows up under system->templates and doesn't generate, it's because the file is missing but says it's not in the xoops_version.php. Make sure you have it named correctly both the file name itself and the
Quote:
$modversion['blocks'][1]['template'] = 'inchat.html';

is correct also.

18
setaside
Re: 3rd party chat advice needed
  • 2003/10/9 16:54

  • setaside

  • Just popping in

  • Posts: 28

  • Since: 2002/9/24


i got mine working a while back (after figuring out that i had to put the php tags in) and i just wanted to say thank you for sharing that block..

i terms of the chat room i think the block makes all the difference whether or not people will join the chat room..

19
DobePhat
Re: 3rd party chat advice needed
  • 2003/10/9 17:31

  • DobePhat

  • Friend of XOOPS

  • Posts: 656

  • Since: 2003/4/15


Thanks!
I didn't realize I had to re-install the mod (I was making changes/updating but the reinstall worked)

Great Job!
Much Appreciated!

20
Draven
Re: 3rd party chat advice needed
  • 2003/10/9 22:02

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28


No problem guys, glad to help. Didn't realize there were others using this chat. It's definitely worth the 5 bucks.

Login

Who's Online

153 user(s) are online (97 user(s) are browsing Support Forums)


Members: 0


Guests: 153


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits