Mchat on Portal

Download and support for PhpBB3 Simple Portal
Locked
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Mchat on Portal

Post by Stoker »

Mchat on Portal
Written by Stoker

Putting the mchat on the portal page is quite easy. You need to have the mchat mod installed.
Lets start with the template edits

Open styles/prosilver/template/simpleportal_body.html
Find:

Code: Select all

<table cellpadding="0" cellspacing="0" border="0" width="100%">
Before add:

Code: Select all

<!-- IF S_MCHAT_ENABLE and S_MCHAT_ON_INDEX and S_MCHAT_LOCATION --><!-- INCLUDE mchat_body.html --><!-- ENDIF -->
Find:

Code: Select all

</table>
After add:

Code: Select all

<!-- IF S_MCHAT_ENABLE and S_MCHAT_ON_INDEX and not S_MCHAT_LOCATION --><!-- INCLUDE mchat_body.html --><!-- ENDIF -->
Open portal.php
Find:

Code: Select all

page_header($user->lang['PORTAL_HEADLINE']);
Before add:

Code: Select all

// BEGIN mChat Mod
$mchat_installed = (!empty($config['mchat_version']) && !empty($config['mchat_enable'])) ? true : false;
if ($mchat_installed && $auth->acl_get('u_mchat_view'))
{
	if(!defined('MCHAT_INCLUDE') && $config['mchat_on_index'] && !empty($user->data['user_mchat_index']))
	{
		define('MCHAT_INCLUDE', true);
		$mchat_include_index = true;
		include($phpbb_root_path . 'mchat.' . $phpEx);
	}	

	if (!empty($config['mchat_stats_index']) && !empty($user->data['user_mchat_stats_index']))
	{
		if (!function_exists('mchat_users'))
		{
			include($phpbb_root_path . 'includes/functions_mchat.' . $phpEx);
		}
		// Add lang file
		$user->add_lang('mods/mchat_lang');
		// stats display
		$mchat_session_time = !empty($config_mchat['timeout']) ? $config_mchat['timeout'] : 3600;// you can change this number to a greater number for longer chat sessions
		$mchat_stats = mchat_users($mchat_session_time);
		$template->assign_vars(array(
			'MCHAT_INDEX_STATS'	=> true,
			'MCHAT_INDEX_USERS_COUNT'	=> $mchat_stats['mchat_users_count'],
			'MCHAT_INDEX_USERS_LIST'	=> $mchat_stats['online_userlist'],
			'L_MCHAT_ONLINE_EXPLAIN'	=> $mchat_stats['refresh_message'],	
		));
	}
}	
// END mChat Mod
Rich has created a hook for the mchat, only available for his donators.
If you are using that one, skip the portal.php edit and edit the hook instead.

Open includes/hooks/hook_mchat.php
Find:

Code: Select all

if($user->page['page'] == 'index.'.$phpEx)
Replace with:

Code: Select all

if(($user->page['page'] == 'index.'.$phpEx) || ($user->page['page'] == 'portal.'.$phpEx))
Board rules! No PM support
User avatar
neuropass
BBCoder IV
BBCoder IV
Posts: 173
Joined: 11 Apr 2010, 02:33

Mchat on Portal

Post by neuropass »

Code: Select all

// BEGIN mChat Mod
$mchat_installed = (!empty($config['mchat_on_index']) && !empty($config['mchat_enable'])) ? true : false;
if(!defined('MCHAT_INCLUDE') && $mchat_installed && $auth->acl_get('u_mchat_view') && $user->data['user_mchat_index'])
{
	define('MCHAT_INCLUDE', true);
	$mchat_include_index = true;
	include($phpbb_root_path . 'mchat.' . $phpEx);
}
// END mChat Mod

simply adding this to the portal.php wouldn't be enough to get mchat working? what's the benefit of the extra code and the other edit in the hook file?
Modd it up! TweakScene ;-) Support us! || Follow us ||

Image
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Mchat on Portal

Post by Stoker »

neuropass wrote:

Code: Select all

// BEGIN mChat Mod
$mchat_installed = (!empty($config['mchat_on_index']) && !empty($config['mchat_enable'])) ? true : false;
if(!defined('MCHAT_INCLUDE') && $mchat_installed && $auth->acl_get('u_mchat_view') && $user->data['user_mchat_index'])
{
	define('MCHAT_INCLUDE', true);
	$mchat_include_index = true;
	include($phpbb_root_path . 'mchat.' . $phpEx);
}
// END mChat Mod

simply adding this to the portal.php wouldn't be enough to get mchat working?
No, you have to add the code I postet. Its testet and working.
neuropass wrote:what's the benefit of the extra code and the other edit in the hook
It makes the mchat work on portal ;)
Without it the mchat only will work on index.
Board rules! No PM support
User avatar
neuropass
BBCoder IV
BBCoder IV
Posts: 173
Joined: 11 Apr 2010, 02:33

Mchat on Portal

Post by neuropass »

I'm asking those questions , because I have mchat working only with the edit i posted above in the portal.php. (which are the same for the index.php page.


so it does work anyway. I thought there was some server load benefit or something with your edits.
Modd it up! TweakScene ;-) Support us! || Follow us ||

Image
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Mchat on Portal

Post by Stoker »

The edit I have posted is for the latest mchat 1.3.5
Yours is an earlier version.
Board rules! No PM support
User avatar
Terr0r
BBCoder V
BBCoder V
Posts: 339
Joined: 04 May 2011, 00:47
BBCodes: 100
Location: The Netherlands
Contact:

Mchat on Portal

Post by Terr0r »

it is possible to set the mChat on the simple portal

now is my qestion is it possible to get it like this
mchatportal.png
so yes how ? what must I do to get it like so as on the image

already thanks for the help :thumb:

Greets Terr0r
If you can't fix it with ducktape you ain't using enough
For my MODS and BBCodes or other things that I have made take a look here
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Mchat on Portal

Post by Stoker »

Insert the code after this:

Code: Select all

<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td valign="top">
Board rules! No PM support
User avatar
Terr0r
BBCoder V
BBCoder V
Posts: 339
Joined: 04 May 2011, 00:47
BBCodes: 100
Location: The Netherlands
Contact:

Mchat on Portal

Post by Terr0r »

that is not good take a look add the picture
chatportal.png
how can I fix that ?

already thanks for the help

Greets Terr0r
If you can't fix it with ducktape you ain't using enough
For my MODS and BBCodes or other things that I have made take a look here
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Mchat on Portal

Post by Stoker »

With the edits I provided for you:
portal.png
Board rules! No PM support
Locked