News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Users Online Today Mod

Started by Nibogo, November 06, 2005, 01:42:31 AM

Previous topic - Next topic

Shades.

Mod page says LATEST VERSION v2.0.4 but in my package manager show version 2.1 ;)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

pikeman

Hello, is a modification for 2.1 planned?

pikeman

I tried a manual installation in 2.1 scripts, it gives a blank page after inserting this code into Sources/BoardIndex.php:
Find it:
$context += getMembersOnlineStats($membersOnlineOptions);
Add after:
// Get the user online today list.
    $context += getUsersOnlineTodayStats();

pocttopus

This mod still works on 2.1.1?

Speed King

Quote from: pocttopus on February 26, 2022, 02:33:38 AMThis mod still works on 2.1.1?

Yes, it works fine without errors (my forum is running on PHP 8.0) :)


pikeman

@Speed King

Without the mistake I mentioned in the previous post?

Speed King

I think it's not needed to add some code in Sources/BoardIndex.php file.

1. Install mod via Package Manager in Emulation mode
2. After mod installation, add manually this code in BoardIndex.template.php for default theme...

Find:

// Showing membergroups?
        if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
            echo '
                <span class="membergroups">' . implode(', ', $context['membergroups']) . '</span>';
    }

Add after:

// Users Online Today
    echo '
            <div class="title_barIC">
                <h4 class="titlebg">
                    <span class="ie6_header floatleft">
                        <img class="icon" src="', $settings['images_url'], '/icons/online.gif', '" alt="', $txt['online_users'], '" />', $txt['uot_users_online_'.$modSettings['uot_setting_period']], '
                    </span>
                </h4>
            </div>
            <p class="inline smalltext">';
    echo
                $txt['uot_total'], ': <b>', $context['num_users_online_today'], '</b>';

            if ($context['viewing_allowed'])
    echo
                ' (', $txt['uot_visible'], ': ', ($context['num_users_online_today'] - $context['num_users_hidden_today']), ', ', $txt['uot_hidden'], ': ', $context['num_users_hidden_today'], ')';

                // Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
                if (!empty($context['users_online_today']) && $context['viewing_allowed'])
                {
    echo
                    '<br />', implode(', ', $context['list_users_online_today']);
                }
    echo '
            </p>';

If you use custom theme with own BoardIndex.template file, make the same changes there.

Also, add 'online.gif' image to ../images/icons folder for each theme used.

See the mod working on my forum:

https://bg-nacionalisti.org/BNF/index.php?action=forum

pikeman

It is the same solution from the previous page. I tested it before and I tried it now, it doesn't work on my forum.

Shades.

Quote from: pikeman on March 05, 2022, 03:56:44 PMIt is the same solution from the previous page. I tested it before and I tried it now, it doesn't work on my forum.
What mods do you have installed if I may ask?
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Speed King

Quote from: pikeman on March 05, 2022, 03:56:44 PMIt is the same solution from the previous page. I tested it before and I tried it now, it doesn't work on my forum.

Did you try to switch your forum to English language? If there's a problem with your default forum language mod files (?Serbian/Croatian), maybe that's the reason  ???

In my forum, the mod works fine since 2019 (SMF 2.1 RC2), and on PHP 7.0 through 8.0

pikeman

#1970
I tried switching to English, the same thing happens. I can't find the mode setting section in the admin panel at all, although I transferred the language files to the appropriate file on the server.


Installed modes:

Simple Colorizer
Curve2 Color Changer
FancyBox 4 SMF
Login Menu Button
Ad Managment
Pretty URLs
Merge Double Posts
FA Board Icons
SMF 2.1.1 Update
Simple Audio Video Embedder

Speed King

The mod settings in admin panel are in section "Configuration => Modification settings => Miscellaneous"

Click =>

Can you install mod via Package Manager or you try to install it manually?

pikeman

Manually, due to an error he reports to me.

Speed King

The mod parser displays that installation needs to run 'db_install.php' file from mod package, this operation cannot be done manually.

Try to install mod via Package Manager, ignoring the error message.
After installation, make the changes described above in BoardIndex.template.php file for default theme.

pikeman

It works, thank you!

Max22

@Nibogo
Please consider to add italian language in the next mod update.

Instructions:
1) Create two files named UsersOnlineToday.italian-utf8.php and UsersOnlineToday.italian.php (for backward compatibility with SMF 2.x)

2) Add the following translated lines:
// Main page
$txt['uot_users_online_current_day']='Utenti di oggi';
$txt['uot_users_online_last_24_hours']='Utenti nelle ultime 24 ore';
$txt['uot_users_online_last_7_days']='Utenti negli ultimi 7 giorni';
$txt['uot_total']='Totale';
$txt['uot_visible']='Visibili';
$txt['uot_hidden']='Nascosti';

// Settings
$txt['uot_setting_sortby_pre_txt']='Ordina la lista utenti per';
$txt['uot_setting_username']='nome utente';
$txt['uot_setting_login_time']='tempo online';
$txt['uot_setting_sortby_post_txt']='';

$txt['uot_setting_sortorder_pre_txt']='Visualizza la lista utenti in';
$txt['uot_setting_ascending']='ordine crescente';
$txt['uot_setting_descending']='ordine decrescente';
$txt['uot_setting_sortorder_post_txt']='';

$txt['uot_setting_period_pre_txt']='La lista utenti dovrebbe coprire';
$txt['uot_setting_current_day']='il giorno corrente';
$txt['uot_setting_last_24_hours']='le ultime 24 ore';
$txt['uot_setting_last_7_days']='gli ultimi 7 giorni';
$txt['uot_setting_period_post_txt']='';

$txt['uot_setting_canview_pre_txt']='Rendi la lista utenti visibile per';
$txt['uot_setting_admin']='amministratori';
$txt['uot_setting_registered']='utenti registrati';
$txt['uot_setting_everyone']='tutti';
$txt['uot_setting_canview_post_txt']=''

3) Update package-info.xml accordingly.


Shades.

ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Max22

Quote from: Nibogo on May 18, 2022, 01:33:18 PMNew version 2.2 released with support for SMF 2.1

Please include the italian translation below in the next version:
https://www.simplemachines.org/community/index.php?msg=4115730

Steve

Quote from: Shades. on May 18, 2022, 02:20:29 PMWorks great,
Not so much for me. Each main index page view gives me one of each of these errors:

The callable users_online_today could not be called.
Hook call: function "users_online_today" in file /home/steve/public_html/forums could not be called.
DO NOT pm me for support!

Advertisement: