This is the code I use on my front page to produce a php Stats block, as in the attached image. Anyone know what code I need to add, to show users in gallery? Who / what album /what pic they're viewing etc. Anyone know if this is even possible.
Using SMF 1.1.8 Tinyportal 0.9.8, and Coppermine 1.4.21 www.cameracraniums.com
global $context, $settings, $options, $scripturl, $txt, $user_info, $modSettings;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet3 = '<img src="'.$settings['images_url'].'/TPdivider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet4 = '<img src="'.$settings['images_url'].'/tpgoto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet5 = '<img src="'.$settings['images_url'].'/tpmodule2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
echo'
<div class="smalltext" style="font-family: verdana, arial, sans-serif;">';
if(isset($context['TPortal']['userbox']['stats']))
// members stats
echo '
<img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
<a href="'.$scripturl.'?action=mlist"><b>'.$txt[19].'</b></a>
<br />'.$bullet.$txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
<br />'.$bullet.$txt['tp-latest']. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';
if(isset($context['TPortal']['userbox']['stats_all']))
global $db_prefix,$modSettings;
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');
$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);
settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");
echo '<br />',$bullet,'New This Month: ', $row['month'],'<br />';
echo $bullet,'New This Week: ', $row['week'],'<br />';
echo $bullet,'New Today: ', $row['today'];
// more stats
echo '
<hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />
<a href="'.$scripturl.'?action=stats"><b>'.$txt['tp-stats'].'</b></a>
<br />'.$bullet.$txt[489].': '.$modSettings['totalMessages']. '
<br />'.$bullet. $txt[490].': '.$modSettings['totalTopics']. '
<br />'.$bullet.$txt['tp-mostonline-today'].': '.$modSettings['mostOnlineToday'].'
<br />'.$bullet.$txt['tp-mostonline'].': '.$modSettings['mostOnline'].'<br />
('.timeformat($modSettings['mostDate']).')
';
if(isset($context['TPortal']['userbox']['online'])){
// add online users
echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
<a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br />';
$online = ssi_whosOnline('array');
echo $bullet.$txt['tp-users'].': '.$online['num_users'];
echo '<br />'.$bullet.$txt['tp-guests'].': '.$online['guests'];
echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';
foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
}
echo '</div>';
}
echo '</div>';
// add arcade users
echo '<div class="smalltext" style="font-family: verdana, arial, sans-serif;">
<hr />
<img src="/arcade.png"><a href="'.$scripturl.'?action=arcade"><b> Users in Arcade</b></a><br />';
//added code
echo' <div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';
// Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
$arcade_users = array();
foreach($online['users'] as $user)
{
$result = db_query("
SELECT url
FROM {$db_prefix}log_online
WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);
$checkit = mysql_fetch_assoc($result);
$data = @unserialize($checkit['url']);
if (isset($data['action']) && ($data['action']=='arcade'))
{
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link']; echo '<br />';
$arcade_users[] = $user;
}
unset($data);
}
// No arcade users?
if(empty($arcade_users))
echo '<br />No members in the arcade';
// end wdmboard_statsonline
echo'</div>
</div>';
Coppermine doesn't record that, so there's no easy mod to accomplish that tracking.
Thanks Joachim
Will this sort of thing be added to 1.5? There's loads of people that bridge / integrate Coppermine with SMF, so this would be a nice feature. Even better if it could be hooked up automatically when you use the bridge.
No, I don't think so. We have a feature freeze for cpg1.5.x and the feature you request isn't in it, so no, actually I'm quite sure that it won't be in cpg1.5.x