Who is online? | In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest None Most users ever online was 108 on Mon Apr 12, 2021 4:36 am |
|
| New posts | | | No new posts | | | Forum is locked |
| idk |
hookGetOnline
List of online user in the past x hours and group legends
RobertMidd
RobertMidd@sky.com
http://forums.planetcweb.com
hookGetOnline1.0.1
Settings: Group Legend groups to show, Group legend links, Group legend separator, Group legend show prefix/suffix, Group legend sort key, Group legend sort order, Online anonymous groups, Online list groups , Online list hours to cutoff, Online list separator character, Online list show prefix/suffix, Online list show profile links, Online list sort key, Online list sort order, Online show user popup, Show group legend";s:9:"templates";s:34:"From skin_boards: 0, hookGetOnline";}s:13:"settingGroups";a:1:{i:0;i:68;}s:8:"settings";a:16:{i:0;i:874;i:1;i:875;i:2;i:876;i:3;i:877;i:4;i:878;i:5;i:879;i:6;i:880;i:7;i:881;i:8;i:882;i:9;i:883;i:10;i:884;i:11;i:885;i:12;i:886;i:13;i:887;i:14;i:888;i:15;i:889;}s:8:"language";a:1:{s:20:"forums_public_boards";a:3:{s:0:"";s:16:"hookgroup_legend";i:1;s:18:"hookonline_members";i:2;s:14:"hookpast_hours";}}s:9:"templates";a:1:{s:11:"skin_boards";a:1:{i:0;s:13:"hookGetOnline";}}}]]>
hookGetOnline
hookgetonlineusers.php
templateHooks
hookgetonlineusers
array(),
'GROUPS' =>array(),
'MEMBERS' => 0 ,
);
public function __construct()
{
/* Make registry objects */
$this->registry = ipsRegistry::instance();
$this->DB = $this->registry->DB();
$this->settings = $this->registry->settings();
$this->memberData =& $this->registry->member()->fetchMemberData();;
}
public function getOutput()
{
if ($this->settings['hookonline_hours']){
$groups = explode( ',', $this->settings['hookonline_groups']);
if (is_array ($groups)){
$this->GetOnline($groups);
}
}
if ($this->settings['hookgroups_show']){
$this->GetGroupLegends();
}
if ( $this->data){
return $this->registry->output->getTemplate( 'boards' )->hookGetOnline($this->data);
}
}
public function GetOnline($groups)
{
if (in_array( $this->memberData['member_group_id'], $groups )){
if( !intval($this->settings['hookonline_hours'] ))
{
$this->settings['hookonline_hours'] = 24;
}
//-----------------------------------------
// Get the users from the DB
//-----------------------------------------
$hookonline_cut = $this->settings['hookonline_hours'] * 3600;
$order= $this->settings['hookonline_sort'] .' '.$this->settings['hookonline_order'];
$timenow = time() - $hookonline_cut;
$members = array();
$this->DB->build( array(
'select' => 'member_id, members_display_name, members_seo_name, last_activity, member_group_id, login_anonymous',
'from' => 'members',
'where' => "last_activity > $timenow",
'order' => "$order"
) );
$this->DB->execute();
while ( $member = $this->DB->fetch() )
{
$anon='';
if ($member['login_anonymous'] == '1&0' or $member['login_anonymous'] == '1&1'){
$groups = explode( ',', $this->settings['hookonline_anon_groups']);
if (is_array ($groups)){
if (!in_array( $this->memberData['member_group_id'], $groups )){
continue;
}
$anon ='*';
}else{
continue;
}
}
$this->data['MEMBERS']++;
$last_date = $this->registry->getClass('class_localization')->getTime( $member['last_activity'] );
if ($this->settings['hookonline_presuf']){
$member['members_display_name'] = IPSLib::makeNameFormatted( $member['members_display_name'], $member['member_group_id'] );
}
$userpop='';
if ($this->settings['hookonline_links']){
if ($this->settings['hookonline_userpop']){
$userpop=$this->registry->output->getTemplate( 'global')->user_popup($member['member_id'], $member['member_seo_name']);
}
$this->data['NAMES'][] = "buildSEOUrl( "showuser={$member['member_id']}", 'public', $member['members_seo_name'], 'showuser' ) ."' title='$last_date'>{$member['members_display_name']}$anon$userpop";
}else{
if ($this->settings['hookonline_userpop']){
$userpop=$this->registry->output->getTemplate( 'global')->user_popup($member['member_id'], $member['member_seo_name']);
}
$this->data['NAMES'][] = "".$member['members_display_name'].$anon.$userpop."";
}
}
}
}
public function GetGroupLegends(){
if ($this->settings['hookgroups_customorder']){
$custom = explode (",",$this->settings['hookgroups_customorder']);
}
$order= $this->settings['hookgroups_sort'] .' '.$this->settings['hookgroups_order'];
$where = $this->settings['hookgroups_showgroups'];
if ($this->settings['hookgroups_showgroups']){
$where = "g_id in (".$this->settings['hookgroups_showgroups'].")";
}
$this->DB->build( array(
'select' => 'g_id, g_title,prefix,suffix',
'from' => 'groups',
'where' => $where,
'order' => "$order"
) );
$this->DB->execute();
while ( $group= $this->DB->fetch() ){
$key = $group['g_id'];
if (is_array($custom)){
$key = array_search($group['g_id'],$custom);
}
$groups[$key] = $group;
}
if (is_array($custom)){
ksort($groups);
}
Foreach ($groups as $group){
if ($this->settings['hookgroups_presuf']){
$group['g_title'] = IPSLib::makeNameFormatted( $group['g_title'], $group['g_id'] );
}
if ($this->settings['hookgroups_links']){
$this->data['GROUPS'][] = "buildSEOUrl( "app=members§ion=view&module=list&filter={$group['g_id']}", 'public', $group['seo_name'], 'members' ) ." '>{$group['g_title']}";
}else{
$this->data['GROUPS'][]=$group['g_title'];
}
}
}
}]]>
1
Settings for Online Users and group legends
0
getonline
forums
Hooks
761
Group Legend Custom Sort Order
68
input
hookgroups_customorder
1
15
1
getonline
0
874
Online list hours to cutoff
Search for members online within these number of hours (set to 0 to disable)
68
input
hookonline_hours
24
1
1
Online Users
1
getonline
0
875
Show group legend
Setting this to Yes will show the group legend in the board stats
68
yes_no
hookgroups_show
1
0
10
Group Legend
1
getonline
0
876
Online list groups
Select the groups that can see the list of online members
68
multi
hookonline_groups
2,3,4,6
#show_groups#
1
8
1
getonline
0
877
Online list show profile links
This setting determines if the members name can be clicked to view their profiles
68
yes_no
hookonline_links
1
1
2
1
getonline
0
878
Online list show prefix/suffix
The setting will allow the formatting of the members name to include the prefix and suffix for their group.
68
yes_no
hookonline_presuf
1
1
4
1
getonline
0
879
Online list sort key
This allows the online list sort key to be set.
68
dropdown
hookonline_sort
last_activity
last_activity=Last Activity
members_display_name=Members Display Name
member_id=Members Id
1
6
1
getonline
0
880
Online list sort order
This allows the list to be sorted ascending or descending of the above key.
68
dropdown
hookonline_order
desc
asc=Ascending
desc=Descending
1
7
1
getonline
0
881
Group legend show prefix/suffix
The setting will allow the formatting of the group name to include the prefix and suffix for the group.
68
yes_no
hookgroups_presuf
1
1
13
1
getonline
0
882
Group legend sort key
This is allows the group legend sort key to be set.
68
dropdown
hookgroups_sort
g_title
g_title=Group Name
g_id=Group Id
1
16
1
getonline
0
883
Group legend sort order
This allows the group legend list to be sorted ascending or descending of the above key.
68
dropdown
hookgroups_order
asc
asc=Ascending
desc=Descending
1
17
1
getonline
0
884
Group legend links
This allows the groups listed to be linked to the members profile search so that if enabled and the link is clicked then a list of members in that group will be displayed
68
yes_no
hookgroups_links
1
1
12
1
getonline
0
885
Online list separator character
This is the character that will be used to separate the list of online members.
68
input
hookonline_sep
,
1
5
1
getonline
0
886
Group legend separator
This is the character that will be used to separate the group legend list
68
input
hookgroups_sep
|
1
14
1
getonline
0
887
Online show user popup
Setting this will put the userpop against the name in the online list
68
yes_no
hookonline_userpop
1
3
1
getonline
0
888
Online anonymous groups
Select the groups that can see members who have logged in anonymously
68
multi
hookonline_anon_groups
6
#show_groups#
1
9
1
getonline
0
889
Group Legend groups to show
This is the list of groups to show in the group legend.
68
multi
hookgroups_showgroups
6,2,3,4
#show_groups#
1
11
1
getonline
0
forums
public_boards
hookonline_members
online member(s)
0
forums
public_boards
hookgroup_legend
Group Legend
0
forums
public_boards
hookpast_hours
(in the past %s hours)
0
0
skin_boards
lang->words['hookpast_hours'],$this->settings['hookonline_hours'])">
{$stats['MEMBERS']} {$this->lang->words['hookonline_members']} $hours
{parse expression="implode( "{$this->settings['hookonline_sep']} ", $stats['NAMES'] )"}
{$this->lang->words['hookgroup_legend']}
{parse expression="implode( "{$this->settings['hookgroups_sep']} ", $stats['GROUPS'] )"}
]]>
hookGetOnline
$stats
1250407236
1
1
1
0
root
|
|