by axew3 » Thu Mar 17, 2022 8:09 am
FIX
The last added widget
phpBB forums online and stats code
has been updated at date of this post:
to correctly display avatars div when avatars images active. Also an instruction has been moved out of a foreach because redundant
please update to this fixed file downloading here (if already updated to 2.6.0 at date of this post):
https://plugins.trac.wordpress.org/expo ... _stats.php
and replace the file into:
/wp-content/plugins/wp-w3all-phpbb-integration/views/phpbb_uonline_stats.php
the new fixed and correct code of this file is this now (if you wish to update with just a copy/paste on file replacing old code on it):
Code: Select all
<?php defined( 'ABSPATH' ) or die( 'forbidden' );
// remove adding // or activate by removing //
echo '<div>'.__( 'Most users ever online was: ', 'wp-w3all-phpbb-integration' ) . W3PHPBBCONFIG['record_online_users'] . '</div>'
. '<div>'.__( 'Registered users: ', 'wp-w3all-phpbb-integration' ) . W3PHPBBCONFIG['num_users'] . '</div>'
. '<div>'.__( 'Topics: ', 'wp-w3all-phpbb-integration' ) . W3PHPBBCONFIG['num_topics'] . '</div>'
. '<div>'.__( 'Posts: ', 'wp-w3all-phpbb-integration' ) . W3PHPBBCONFIG['num_posts'] . '</div>'
. '<div>'.__( 'There are', 'wp-w3all-phpbb-integration' ) . ' ' .$guests_num. ' '. __( 'guests ', 'wp-w3all-phpbb-integration' ) . __( 'and', 'wp-w3all-phpbb-integration' ) . ' ' .$reg_num. ' ' . __( 'users online ', 'wp-w3all-phpbb-integration' )
//. __( '<br />(based on users active over the past', 'wp-w3all-phpbb-integration' ).' '.W3PHPBBCONFIG['load_online_time']. ' ' .__( 'minutes)', 'wp-w3all-phpbb-integration' ).'</div>'
.'<br />';
echo'<div id="" class="w3_widget_online_udata" style="display:flex;flex-wrap:wrap;padding:0;">';
if( $ava_or_ulinks == 'avatars' ){ // avatars
$avatar_dim = empty(intval($ava_dimension)) ? $w3all_last_t_avatar_dim : $ava_dimension;
foreach($phpbb_online_udata as $udata) :
if($udata['user_id'] > 2){
echo'<div class="w3_ava_wonline" style="text-align:center;padding:5px 5px 5px 0;width:'.$avatar_dim.'px">';
// use widget $ava_dimension if the value has been set for this widget
// do not rewrite global $w3all_last_t_avatar_dim
if( $online_ulink_yn > 0 ){
echo get_avatar($udata['user_email'], $avatar_dim,'',$udata['username'])
.'<a href="'.$w3all_url_to_cms.'/memberlist.php?mode=viewprofile&u='.$udata['user_id'].'">'.$udata['username'].'</a>';
} else {
echo '<a href="'.$w3all_url_to_cms.'/memberlist.php?mode=viewprofile&u='.$udata['user_id'].'">'.get_avatar($udata['user_email'], $avatar_dim,'',$udata['username']).'</a>';
}
echo'</div>';
}
endforeach;
} // END with avatars
if( $ava_or_ulinks == 'links' ){ // usernames text links
foreach($phpbb_online_udata as $udata) :
echo'<div class="w3_ulinks_wonline" style="text-align:center;padding:0 5px 5px 0">';
if($udata['user_id'] > 2){
echo '<a href="'.$w3all_url_to_cms.'/memberlist.php?mode=viewprofile&u='.$udata['user_id'].'">'.$udata['username'].'</a>';
}
echo'</div>';
endforeach;
} // END with usernames text links
echo '</div>';
- online_stats.png (13.65 KiB) Viewed 2082 times
check the file to see how it is easy to customize as more you like. check widgets options and activate as links, avatars, avatars with link etc
FIX
The last added widget [size=180]phpBB forums online and stats[/size] code
has been updated at date of this post:
to correctly display avatars div when avatars images active. Also an instruction has been moved out of a foreach because redundant
please update to this fixed file downloading here (if already updated to 2.6.0 at date of this post):
https://plugins.trac.wordpress.org/export/HEAD/wp-w3all-phpbb-integration/trunk/views/phpbb_uonline_stats.php
[b]
and replace the file into:[/b]
[i]/wp-content/plugins/wp-w3all-phpbb-integration/views/[b]phpbb_uonline_stats.php[/b][/i]
the new fixed and correct code of this file is this now (if you wish to update with just a copy/paste on file replacing old code on it):
[code]<?php defined( 'ABSPATH' ) or die( 'forbidden' );
// remove adding // or activate by removing //
echo '<div>'.__( 'Most users ever online was: ', 'wp-w3all-phpbb-integration' ) . W3PHPBBCONFIG['record_online_users'] . '</div>'
. '<div>'.__( 'Registered users: ', 'wp-w3all-phpbb-integration' ) . W3PHPBBCONFIG['num_users'] . '</div>'
. '<div>'.__( 'Topics: ', 'wp-w3all-phpbb-integration' ) . W3PHPBBCONFIG['num_topics'] . '</div>'
. '<div>'.__( 'Posts: ', 'wp-w3all-phpbb-integration' ) . W3PHPBBCONFIG['num_posts'] . '</div>'
. '<div>'.__( 'There are', 'wp-w3all-phpbb-integration' ) . ' ' .$guests_num. ' '. __( 'guests ', 'wp-w3all-phpbb-integration' ) . __( 'and', 'wp-w3all-phpbb-integration' ) . ' ' .$reg_num. ' ' . __( 'users online ', 'wp-w3all-phpbb-integration' )
//. __( '<br />(based on users active over the past', 'wp-w3all-phpbb-integration' ).' '.W3PHPBBCONFIG['load_online_time']. ' ' .__( 'minutes)', 'wp-w3all-phpbb-integration' ).'</div>'
.'<br />';
echo'<div id="" class="w3_widget_online_udata" style="display:flex;flex-wrap:wrap;padding:0;">';
if( $ava_or_ulinks == 'avatars' ){ // avatars
$avatar_dim = empty(intval($ava_dimension)) ? $w3all_last_t_avatar_dim : $ava_dimension;
foreach($phpbb_online_udata as $udata) :
if($udata['user_id'] > 2){
echo'<div class="w3_ava_wonline" style="text-align:center;padding:5px 5px 5px 0;width:'.$avatar_dim.'px">';
// use widget $ava_dimension if the value has been set for this widget
// do not rewrite global $w3all_last_t_avatar_dim
if( $online_ulink_yn > 0 ){
echo get_avatar($udata['user_email'], $avatar_dim,'',$udata['username'])
.'<a href="'.$w3all_url_to_cms.'/memberlist.php?mode=viewprofile&u='.$udata['user_id'].'">'.$udata['username'].'</a>';
} else {
echo '<a href="'.$w3all_url_to_cms.'/memberlist.php?mode=viewprofile&u='.$udata['user_id'].'">'.get_avatar($udata['user_email'], $avatar_dim,'',$udata['username']).'</a>';
}
echo'</div>';
}
endforeach;
} // END with avatars
if( $ava_or_ulinks == 'links' ){ // usernames text links
foreach($phpbb_online_udata as $udata) :
echo'<div class="w3_ulinks_wonline" style="text-align:center;padding:0 5px 5px 0">';
if($udata['user_id'] > 2){
echo '<a href="'.$w3all_url_to_cms.'/memberlist.php?mode=viewprofile&u='.$udata['user_id'].'">'.$udata['username'].'</a>';
}
echo'</div>';
endforeach;
} // END with usernames text links
echo '</div>';[/code]
[attachment=0]online_stats.png[/attachment]
check the file to see how it is easy to customize as more you like. check widgets options and activate as links, avatars, avatars with link etc