Modificare mod 24 H stats
Reguli forum
Aveti o problema si vreti sa primiti ajutor? Click aici ! Nu uitati si de regulamentul forumului !
Aveti o problema si vreti sa primiti ajutor? Click aici ! Nu uitati si de regulamentul forumului !
Modificare mod 24 H stats
Cum pot modifica acel mod sa arate useri si toate cele in ultimele 48 de ore , ci nu 24 de ore ?
- dorin
- Fost coleg
- Mesaje: 4620
- Membru din: 24-Iun-2003, 23:23:29
- Versiune: 3.1.10
- Ext: Da
- Server: UNIX/Linux
- Nivel phpBB: Mediu
- Nivel php: Puţin experimentat
- Contact:
Re: Modificare mod 24 H stats
Un link către acest MOD ?
- Tiestto
- Utilizator înregistrat
- Mesaje: 127
- Membru din: 14-Mar-2009, 17:17:53
- Versiune: phpbb3.0.7
- Ext: Da
- Server: UNIX/Linux
- Nivel phpBB: Mediu
- Localitate: Poeni
- Contact:
Re: Modificare mod 24 H stats
Posteaza aici fisierul .php din includes , este o rezolvare usoara
.

---- LIBER ---
-
- Utilizator înregistrat
- Mesaje: 94
- Membru din: 01-Iul-2009, 18:21:20
- Versiune: 3.0.5
- Ext: Nu
- Server: Windows
- Nivel phpBB: Mediu
Re: Modificare mod 24 H stats
care fisier php ? functions_activity_stats.php ? ca si pe mine ma intereseaza
-
- Utilizator înregistrat
- Mesaje: 94
- Membru din: 01-Iul-2009, 18:21:20
- Versiune: 3.0.5
- Ext: Nu
- Server: Windows
- Nivel phpBB: Mediu
Re: Modificare mod 24 H stats
Cod: Selectaţi tot
<?php
/**
*
* @package phpBB3
* @author Highway of Life ( David Lewis ) http://startrekguide.com
* @version $Id$
* @copyright (c) 2008 Star Trek Guide Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit();
}
/**
* Display extra stats, activity over the last 24 hours for new users, posts and topics.
*
* @return bool
*/
function activity_mod()
{
global $template, $user;
$user->add_lang('mods/activity_stats');
// if the user is a bot, we won’t even process this function...
if ($user->data['is_bot'])
{
return false;
}
// obtain user activity data
$active_users = obtain_active_user_data();
// obtain posts/topics/new users activity
$activity = obtain_activity_data();
// 24 hour users online list, assign to the template block: lastvisit
foreach ($active_users as $row)
{
$template->assign_block_vars('lastvisit', array(
'USERNAME_FULL' => get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
));
}
// assign the stats to the template.
$template->assign_vars(array(
'USERS_24HOUR_TOTAL' => sprintf($user->lang['USERS_24HOUR_TOTAL'], sizeof($active_users)),
'24HOUR_TOPICS' => sprintf($user->lang['24HOUR_TOPICS'], $activity['topics']),
'24HOUR_POSTS' => sprintf($user->lang['24HOUR_POSTS'], $activity['posts']),
'24HOUR_USERS' => sprintf($user->lang['24HOUR_USERS'], $activity['users']),
));
return true;
}
/**
* Obtain an array of active users over the last 24 hours.
*
* @return array
*/
function obtain_active_user_data()
{
global $cache;
if (($active_users = $cache->get('_active_users')) === false)
{
global $db;
$active_users = array();
// grab a list of users who are currently online
// and users who have visited in the last 24 hours
$sql_ary = array(
'SELECT' => 'u.user_id, u.user_colour, u.username, u.user_type',
'FROM' => array(USERS_TABLE => 'u'),
'LEFT_JOIN' => array(
array(
'FROM' => array(SESSIONS_TABLE => 's'),
'ON' => 's.session_user_id = u.user_id',
),
),
'WHERE' => 'u.user_lastvisit > ' . (time() - 86400) . ' OR s.session_user_id <> ' . ANONYMOUS,
'GROUP_BY' => 'u.user_id',
'ORDER_BY' => 'u.username',
);
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
while ($row = $db->sql_fetchrow($result))
{
$active_users[$row['user_id']] = array(
'user_id' => $row['user_id'],
'user_type' => $row['user_type'],
'username' => $row['username'],
'user_colour' => $row['user_colour'],
);
}
$db->sql_freeresult($result);
// cache this data for 1 hour, this improves performance
$cache->put('_active_users', $active_users, 3600);
}
return $active_users;
}
/**
* obtained cached 24 hour activity data
*
* @return array
*/
function obtain_activity_data()
{
global $cache;
if (($activity = $cache->get('_activity_mod')) === false)
{
global $db;
// set interval to 24 hours ago
$interval = time() - 86400;
$activity = array();
// total new posts in the last 24 hours
$sql = 'SELECT COUNT(post_id) AS new_posts
FROM ' . POSTS_TABLE . '
WHERE post_time > ' . $interval;
$result = $db->sql_query($sql);
$activity['posts'] = $db->sql_fetchfield('new_posts');
$db->sql_freeresult($result);
// total new topics in the last 24 hours
$sql = 'SELECT COUNT(topic_id) AS new_topics
FROM ' . TOPICS_TABLE . '
WHERE topic_time > ' . $interval;
$result = $db->sql_query($sql);
$activity['topics'] = $db->sql_fetchfield('new_topics');
$db->sql_freeresult($result);
// total new users in the last 24 hours, counts inactive users as well
$sql = 'SELECT COUNT(user_id) AS new_users
FROM ' . USERS_TABLE . '
WHERE user_regdate > ' . $interval;
$result = $db->sql_query($sql);
$activity['users'] = $db->sql_fetchfield('new_users');
$db->sql_freeresult($result);
// cache this data for 1 hour, this improves performance
$cache->put('_activity_mod', $activity, 3600);
}
return $activity;
}
?>
- Tiestto
- Utilizator înregistrat
- Mesaje: 127
- Membru din: 14-Mar-2009, 17:17:53
- Versiune: phpbb3.0.7
- Ext: Da
- Server: UNIX/Linux
- Nivel phpBB: Mediu
- Localitate: Poeni
- Contact:
Re: Modificare mod 24 H stats
Poftim incearcva cu asta :
Scuzama de intarziere !
Cod: Selectaţi tot
<?php
/**
*
* @package phpBB3
* @author Highway of Life ( David Lewis ) http://startrekguide.com
* @version $Id$
* @copyright (c) 2008 Star Trek Guide Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit();
}
/**
* Display extra stats, activity over the last 24 hours for new users, posts and topics.
*
* @return bool
*/
function activity_mod()
{
global $template, $user;
$user->add_lang('mods/activity_stats');
// if the user is a bot, we won’t even process this function...
if ($user->data['is_bot'])
{
return false;
}
// obtain user activity data
$active_users = obtain_active_user_data();
// obtain posts/topics/new users activity
$activity = obtain_activity_data();
// 24 hour users online list, assign to the template block: lastvisit
foreach ($active_users as $row)
{
$template->assign_block_vars('lastvisit', array(
'USERNAME_FULL' => get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
));
}
// assign the stats to the template.
$template->assign_vars(array(
'USERS_24HOUR_TOTAL' => sprintf($user->lang['USERS_24HOUR_TOTAL'], sizeof($active_users)),
'24HOUR_TOPICS' => sprintf($user->lang['24HOUR_TOPICS'], $activity['topics']),
'24HOUR_POSTS' => sprintf($user->lang['24HOUR_POSTS'], $activity['posts']),
'24HOUR_USERS' => sprintf($user->lang['24HOUR_USERS'], $activity['users']),
));
return true;
}
/**
* Obtain an array of active users over the last 24 hours.
*
* @return array
*/
function obtain_active_user_data()
{
global $cache;
if (($active_users = $cache->get('_active_users')) === false)
{
global $db;
$active_users = array();
// grab a list of users who are currently online
// and users who have visited in the last 24 hours
$sql_ary = array(
'SELECT' => 'u.user_id, u.user_colour, u.username, u.user_type',
'FROM' => array(USERS_TABLE => 'u'),
'LEFT_JOIN' => array(
array(
'FROM' => array(SESSIONS_TABLE => 's'),
'ON' => 's.session_user_id = u.user_id',
),
),
'WHERE' => 'u.user_lastvisit > ' . (time() - 345600) . ' OR s.session_user_id <> ' . ANONYMOUS,
'GROUP_BY' => 'u.user_id',
'ORDER_BY' => 'u.username',
);
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
while ($row = $db->sql_fetchrow($result))
{
$active_users[$row['user_id']] = array(
'user_id' => $row['user_id'],
'user_type' => $row['user_type'],
'username' => $row['username'],
'user_colour' => $row['user_colour'],
);
}
$db->sql_freeresult($result);
// cache this data for 1 hour, this improves performance
$cache->put('_active_users', $active_users, 7200);
}
return $active_users;
}
/**
* obtained cached 24 hour activity data
*
* @return array
*/
function obtain_activity_data()
{
global $cache;
if (($activity = $cache->get('_activity_mod')) === false)
{
global $db;
// set interval to 24 hours ago
$interval = time() - 345600;
$activity = array();
// total new posts in the last 24 hours
$sql = 'SELECT COUNT(post_id) AS new_posts
FROM ' . POSTS_TABLE . '
WHERE post_time > ' . $interval;
$result = $db->sql_query($sql);
$activity['posts'] = $db->sql_fetchfield('new_posts');
$db->sql_freeresult($result);
// total new topics in the last 24 hours
$sql = 'SELECT COUNT(topic_id) AS new_topics
FROM ' . TOPICS_TABLE . '
WHERE topic_time > ' . $interval;
$result = $db->sql_query($sql);
$activity['topics'] = $db->sql_fetchfield('new_topics');
$db->sql_freeresult($result);
// total new users in the last 24 hours, counts inactive users as well
$sql = 'SELECT COUNT(user_id) AS new_users
FROM ' . USERS_TABLE . '
WHERE user_regdate > ' . $interval;
$result = $db->sql_query($sql);
$activity['users'] = $db->sql_fetchfield('new_users');
$db->sql_freeresult($result);
// cache this data for 1 hour, this improves performance
$cache->put('_activity_mod', $activity, 7200);
}
return $activity;
}
?>
Scuzama de intarziere !
---- LIBER ---
Cine este conectat
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 1 vizitator