Help To Install This Mod On Category Hiearchy


Subject: Help To Install This Mod On Category Hiearchy
suppose this mod is adding user viewing info on forums on index, but i cant find the exact code on index to install this mod, i know the CH mod had altered the index, so if any one could help to add it on forum with CH mod installed( the code to add on index i think should be on functions_Categoy_hierarchy.php but i am not sure) so please help me

Code: [Download] [Hide] [Select]

#################################################################
## Mod Title: Counter user access to a box of forum
## Mod Author: BaoChung (VietNam) < wall85vn@yahoo.com >
## Mod Version: 1.0.2
## Mod Time: 22/03/06
## Mod Description: This will help users can see how many user are
## viewing into forums. It like "12 viewing"
##
## Installation Level: Easy
## Installation Time: 15 Minutes
##
## Files To Edit: 3 (it is 4 if Easy Sub-Forums was installed)
## index.php
## viewforum.php (if Easy Sub-Forums was installed)
## includes/session.php
## templates/yourtemplate/index_body.tpl
##
## Included Files: (none)
##
## NOTE: it can have some non-acuracy, tell me if you have
## a problem with it. See website http://vietshare.tk for the demo
##
#################################################################
## WHAT'S NEW IN THIS VERSION (1.0.2)?
## - fix code to show more correcly
## - make it can work with Easy Sub-Forums MOD v1.0.8
#################################################################
## THANKS TO
## Phuong < anhchang_pcit@yahoo.com > for report some error
##
#################################################################

#
#-----[ SQL Query ]----------------------------------------------
# If your phpbb table prefix is different, then change it to
# reflect the correct one.

ALTER TABLE `phpbb_sessions` ADD `session_forum` INT( 15 ) NOT NULL DEFAULT '0';

#################################################################
#
#-----[ OPEN ]---------------------------------------------------
#
index.php
#
#-----[ FIND ]---------------------------------------------------
#

//
// Start page proper
//
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order

#
#-----[ BEFORE, ADD ]--------------------------------------------
#

//
// BEGIN: number of user view forum
//
$sql = "SELECT s.session_forum, count(*) as numviewforum
FROM ".SESSIONS_TABLE." s
WHERE (s.session_time >= ".( time() - 300 ) . ")
GROUP BY s.session_forum";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain reg user/online information', '', __LINE__, __FILE__, $sql);
}

$session_forum_rows = array();

while( $row = $db->sql_fetchrow($result) )
{
$session_forum_rows[] = $row;
}
$db->sql_freeresult($result);

function getIDsessionforum($n)
{
global $session_forum_rows;
for ($i=0; $i<count($session_forum_rows); $i++)
if($session_forum_rows[$i]['session_forum']==$n) return $i;
return -1;
}
//
// END: number of user view forum
//

#
#-----[ FIND ]---------------------------------------------------
#
for($j = 0; $j < $total_forums; $j++)
{
if ( $forum_data[$j]['cat_id'] == $cat_id )
{

#
#-----[ AFTER, ADD ]---------------------------------------------
#
$nviewforum=0;
#
#-----[ FIND ]---------------------------------------------------
# it has just been used if Easy Sub-Forums MOD was installed

$sub_forum_id = $value['forum_id'];
if ($value['attached_forum_id']==$forum_id && $is_auth_ary[$sub_forum_id]['auth_view'])
{

#
#-----[ AFTER, ADD ]---------------------------------------------
# it has just been used if Easy Sub-Forums MOD was installed

$nviewforum+=$session_forum_rows[getIDsessionforum($sub_forum_id)]['numviewforum'];

#
#-----[ FIND ]---------------------------------------------------
#
$template->assign_block_vars('catrow.forumrow', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'FORUM_FOLDER_IMG' => $folder_image,
'FORUM_NAME' => $forum_data[$j]['forum_name'],

#
#-----[ BEFORE, ADD ]--------------------------------------------
#
$nviewforum+=$session_forum_rows[getIDsessionforum($j+1)]['numviewforum'];

#
#-----[ AFTER, ADD ]---------------------------------------------
#
'FORUM_VIEW' => ($nviewforum)?'('.$nviewforum.' viewing)':'',

#################################################################
#-----[ OPEN ]---------------------------------------------------
# it has just been used if Easy Sub-Forums MOD was installed

viewforum.php

#
#-----[ FIND ]---------------------------------------------------
# it has just been used if Easy Sub-Forums MOD was installed

$attach_forum_link = append_sid('viewforum.php?f=' . $value['forum_id']);

#
#-----[ BEFORE, ADD ]--------------------------------------------
# it has just been used if Easy Sub-Forums MOD was installed

$sql3 = "SELECT count(*) as numviewforum
FROM ".SESSIONS_TABLE." s
WHERE (s.session_forum=".$value['forum_id'].") AND (s.session_time >= ".( time() - 300 ) . ")
GROUP BY s.session_forum LIMIT 1";
if ( !($result3 = $db->sql_query($sql3)) )
{
message_die(GENERAL_ERROR, 'Could not obtain reg user/online information', '', __LINE__, __FILE__, $sql3);
}

$snumusersforum = "";
if ( $row3 = $db->sql_fetchrow($result3) )
{
$snumusersforum = ($row3['numviewforum'])?'('.$row3['numviewforum'].' viewing)':'';
}
$db->sql_freeresult($result3);

#
#-----[ FIND ]---------------------------------------------------
# it has just been used if Easy Sub-Forums MOD was installed

$attach_forum_name = '<a href="' . append_sid('viewforum.php?f=' . $value['forum_id']) . '">' . $value['forum_name'] . '</a>' ;

#
#-----[ REPLACE ]------------------------------------------------
# it has just been used if Easy Sub-Forums MOD was installed

$attach_forum_name = '<a href="' . append_sid('viewforum.php?f=' . $value['forum_id']) . '">' . $value['forum_name'] . '</a> ' . $snumusersforum ;

#################################################################
#-----[ OPEN ]---------------------------------------------------
#
includes/session.php

#
#-----[ FIND ]---------------------------------------------------
#
//
// Adds/updates a new session to the database for the given userid.
// Returns the new session ID on success.
//

#
#-----[ AFTER, ADD ]---------------------------------------------
#
$myforum=(!empty($HTTP_GET_VARS['f']))?$HTTP_GET_VARS['f']:0;

#
#-----[ FIND ]---------------------------------------------------
#

function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_autologin = 0, $admin = 0)
{
global $db, $board_config;

#
#-----[ AFTER, ADD ]---------------------------------------------
#
global $myforum;

#
#-----[ FIND ]---------------------------------------------------
#
$sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login, $admin)";

#
#-----[ REPLACE ]------------------------------------------------
#
$sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin, session_forum)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login, $admin, $myforum)";

#
#-----[ FIND ]---------------------------------------------------
#

function session_pagestart($user_ip, $thispage_id)
{
global $db, $lang, $board_config;

#
#-----[ AFTER, ADD ]---------------------------------------------
#
global $myforum;

#
#-----[ FIND ]---------------------------------------------------
#
//
// Only update session DB a minute or so after last update
//
if ( $current_time - $userdata['session_time'] > 60 )
{
// A little trick to reset session_admin on session re-usage
$update_admin = (!defined('IN_ADMIN') && $current_time - $userdata['session_time'] > ($board_config['session_length']+60)) ? ', session_admin = 0' : '';

$sql = "UPDATE " . SESSIONS_TABLE . "
SET session_time = $current_time, session_page = $thispage_id$update_admin
WHERE session_id = '" . $userdata['session_id'] . "'";

#
#-----[ REPLACE ]------------------------------------------------
#
$sql = "UPDATE " . SESSIONS_TABLE . "
SET session_forum = $myforum
WHERE session_id = '" . $userdata['session_id'] . "'";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql);
}

//
// Only update session DB a minute or so after last update
//
if ( $current_time - $userdata['session_time'] > 60 )
{
// A little trick to reset session_admin on session re-usage
$update_admin = (!defined('IN_ADMIN') && $current_time - $userdata['session_time'] > ($board_config['session_length']+60)) ? ', session_admin = 0' : '';

$sql = "UPDATE " . SESSIONS_TABLE . "
SET session_time = $current_time, session_page = $thispage_id$update_admin, session_forum = $myforum
WHERE session_id = '" . $userdata['session_id'] . "'";


#################################################################
#-----[ OPEN ]---------------------------------------------------
#
templates/yourtempate/index_body.tpl

#
#-----[ FIND ]---------------------------------------------------
#
<a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a>

#
#-----[ AFTER, ADD ]---------------------------------------------
#
</span><span class="gensmall">&nbsp;{catrow.forumrow.FORUM_VIEW}

#
#-----[ SAVE/CLOSE ALL FILES ]-----------------------------------
#
#EoM

Profile PM  
Subject: Re: Help To Install This Mod On Category Hiearchy
It's not so easy to integrate this... try to look for something similar in functions_categories_hierarchy.php... it will require good php skills to install this.


Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.0947s (PHP: 18% SQL: 82%)
SQL queries: 10 - Debug Off - GZIP Enabled