• 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

Set default channel

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

Post a reply
4 posts • Page 1 of 1

Set default channel

Postby Prognatus » Fri Jan 25, 2013 4:24 pm

I know this has been asked before here, but I didn't understand the answer(s). :? I've searched the Internet for weeks now trying to find an answer to this, without success. So please, please help me!

My problem is this: I create three channels for all users. It works, but all end up in the third channel (last one in the array) and so they have to manually select the first channel by clicking on it.

How do I set the first channel to default?


Here's my index.php:
Code: Select all
<?php
// die('Sorry, but the THT chatroom is closed for maintenance.');

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
 
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
if ($user->data['user_id'] == ANONYMOUS)
{
    login_box('', $user->lang['LOGIN']);
}
date_default_timezone_set('UTC');
$utz = $user->data['user_timezone'];    // Get user's time zone information from phpBB3 account settings
                  
// Output page
page_header('Chatroom');

$template->set_filenames(array(
   'body' => 'chatroom_body.html',)
);

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params                          = array();
$params["theme"]                 = "tht";
$params["title"]                 = " ";
$params["theme_path"]            = "../chat/themes";
$params["nick"]                  = $user->data['username'];
$params["serverid"]            = md5(__FILE__);      // calculate a unique id for this chat
$params["frozen_nick"]           = true;
$params["clock"]                 = false;
$params["startwithsound"]        = false;
$params["btn_sh_whosonline"]     = true;
$params["channels"]              = array('Chat', 'Logo chat', 'War room');
// $params["userchan"]              = array('Chat');   // This doesn't work ...
$params["time_offset"]        = $utz*60*60; // Sets user's time_offset to their timezone
$params["displaytabclosebutton"] = false;
$params["display_ping"]          = false;
$params["timeout"]               = 60000;
$params["max_channels"]          = 3;          // limit the number of joined channels tab to 3
$params["max_privmsg"]           = 1;          // limit the number of private message tab to 1
$params["refresh_delay"]        = 1000;       // chat refresh speed is 10 secondes (10000ms)
$params["max_msg"]             = 15;         // max message in the history is 15 (message seen when reloading the chat)
$params["connect_at_startup"]    = true;
$params["start_minimized"]       = false;
$params["nickmarker"]            = false;
$params["debug"]                 = false;
$params["isadmin"]               = false;
$params["firstisadmin"]          = false;
$params["bbcode_colorlist"]      = array('#FFFFFF','#8DEEEE','#1E90FF','#00FFFF','#FA8072','#DAA520','#FF3030','#FF5500',
                                         '#FFFF00','#00FF00','#98FB98','#F0E68C','#FF69B4','#BA55D3','#FFB5C5','#A3A9AD');
$params["nickname_colorlist"]    = array('#FFFFFF','#8DEEEE','#1E90FF','#00FFFF','#FA8072','#DAA520','#FF3030','#FF5500',
                                         '#FFFF00','#00FF00','#98FB98','#F0E68C','#FF69B4','#BA55D3','#FFB5C5','#A3A9AD');

// Guests / Anonumous, Bots, Newly registered users, and Ambassadors don't have access to chat
if ($user->data['group_id'] == 1 OR $user->data['group_id'] == 6 OR $user->data['group_id'] == 7 OR $user->data['group_id'] == 10)
{
  die('Access denied');
}
// if ($user->data['group_id'] == 4 OR $user->data['group_id'] == 5) // Admins and Moderators
if ($user->data['group_id'] == 9)            // Founder
{
   $params["isadmin"] = true;
}
$chat = new phpFreeChat($params);

// Send data to template
$template->assign_vars(array(
   'S_CHATROOM'   => $chat->printChat(true) . $warning)
);

page_footer();
?>
Prognatus
New member
 
Posts: 4
Joined: Fri Jan 25, 2013 4:03 pm
Location: Oppland, Norway
  • Website
Top

Re: Set default channel

Postby OldWolf » Sat Jan 26, 2013 12:19 am

Maybe this is a stupid idea... but why don't you just reverse the order so that the one you want to be in is the last one?
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

Re: Set default channel

Postby Prognatus » Sat Jan 26, 2013 1:54 am

Yes, I thought of that too. :) If I don't find any other solution I will do that, but I hesitate because it doesn't feel natural.
Prognatus
New member
 
Posts: 4
Joined: Fri Jan 25, 2013 4:03 pm
Location: Oppland, Norway
  • Website
Top

Re: Set default channel

Postby bendeliduka » Tue Mar 12, 2013 4:57 am

What seems to work is to put the channel you want as your 'default' channel as the last channel in the list. This would be a duplicate entry if it's really the first channel...

Example:

$params["channels"] = array('Ch1','Ch2','Ch3','Ch4','Ch1');

when connecting to the chat server I believe the /join code is used to 'join' the channels (creating them if you are the first user on the chat) as such, it joins Ch1, Ch2, Ch3, Ch4, and then Ch1 again leaving you connected to the first channel/tab.
bendeliduka
New member
 
Posts: 2
Joined: Sat Mar 09, 2013 4:01 am
Top


Post a reply
4 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

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