I've made a guide for those who want to show online users from the chat, in a phpbb forum, in the section "Who is online" in the index.
I hope it will be usefull (I think the solution wasn't clearly post in the forum. If it was, I haven't found it).
Here is the code (I've try to show it like a Mod installation instruction)
Important, please read the annotations in the code "// ..."
- Code: Select all
##############################################################
## MOD Title: www.phpfreechat.net: integration of online users in the index of a phpbb forum
## MOD Author: Adaptation of the code from: "demo31_show_who_is_online-whoisonline.php"
## by Ewelthen - www.guilde-echoes.net
## MOD Description: This will add online users from your chat in the index of your phpbb forum
##
## Installation Level: easy
## Installation Time: 5 Minutes
## Files To Edit: 2
## index.php
## templates/YourTemplate/index_body.tpl
##
##############################################################
#
#-----[ OPEN ]---------------------------------------------
#
index.php
#
#-----[ FIND ]---------------------------------------------
#
//
// Start output of page
//
define('SHOW_ONLINE', true);
$page_title = $lang['Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
#
#-----[ BEFORE, ADD ]--------------------------------------
#
// Show users on chat - code from: www.phpfreechat.net
require_once "PARENT_DIRECTORY/chat/src/pfcinfo.class.php";
// You need to change the path with your configuration
$info_chat = new pfcInfo( md5("Chat Name") );
// You need to change the name !
// Take the same as define in the index page of your chat, here : $params["serverid"] = md5("Chat Name");
$users_chat = $info_chat->getOnlineNick(NULL);
$info_chat = "";
$nb_users_chat = count($users_chat);
if ($nb_users_chat <= 1)
$info_chat = "In total there are <strong>%d</strong> user online on chat.";
else
$info_chat = " In total there are <strong>%d</strong> users online on chat.";
foreach($users_chat as $u){
$u = "<b>".$u." </b>";}
#
#-----[ FIND ]---------------------------------------------
#
$template->assign_vars(array(
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
#
#-----[ AFTER, ADD ]--------------------------------------
#
'TOTAL_USERS_ONCHAT' => sprintf($info_chat, $nb_users_chat),
'USERS_ONCHAT' => sprintf($u),
#
#-----[ OPEN ]---------------------------------------------
#
templates/YourTemplate/index_body.tpl
// the code may be a bite different, depends of your template!
#
#-----[ FIND ]---------------------------------------------
#
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} [ {L_WHOSONLINE_ADMIN} ] [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
</tr>
#
#-----[ AFTER, ADD ]--------------------------------------
#
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONCHAT}<br />Utilisateurs enregistrés : {USERS_ONCHAT}</span></td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
If you want to correct my english, add more features ... you are Welcome.
Thank you all from phpfreechat, you have done a great job!