Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

WhosOnline or OnlineNow so it shows all users

I read from the OnlineNow description that "The user needs to do something other than just get online to register as online such as browse a thread." I would prefer having it so that if a user goes online just to see if there is anything new going on that they would still show up as being online now. Is there a way to allow for this? I'm using Vanilla 2.1.11. Thanks.

Comments

  • peregrineperegrine MVP
    edited September 2015

    @gratiafide said:
    I read from the OnlineNow description that "The user needs to do something other than just get online to register as online such as browse a thread." I would prefer having it so that if a user goes online just to see if there is anything new going on that they would still show up as being online now. Is there a way to allow for this? I'm using Vanilla 2.1.11. Thanks.

    re-echoed because of data loss for the last 12 or more hours.

    try this. it may work for you. will keep users in the box for as long as lagtime if they are inactive.

    in class.onlinenowmodule.php

    change
    $History = time() - $Frequency;

    to

              // $History = time() - $Frequency;
            $LagTimeInSeconds = C('Plugins.OnlineNow.LagTimeInSeconds', 60);
            $History = time() - $LagTimeInSeconds;
    

    then in config you could use one of the below or put whatever seconds you want.

    $Configuration['Plugins']['OnlineNow']['LagTimeInSeconds'] = 300; // 5 minutes

    $Configuration['Plugins']['OnlineNow']['LagTimeInSeconds'] = 3600; // one hour

    $Configuration['Plugins']['OnlineNow']['LagTimeInSeconds'] = 7200; // two hours

    then add a definition to your locale.php

    $Definition['Online Now'] = 'Online Recently';
    

    if it were me,

    i'd set the frequency between 30 to 120 seconds. (how often box is refreshed)

    and the lagtime to 300 seconds. (how long since user last clicked or signed in).

    depending on how busy your forum is.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Thank you for these instructions. I was wondering which locale.php file you are referring to? I see the following possibilities:

    applications/dashboard/views/settings/locales.php (but I don't see any other $Definition constants in this file)

    or

    applications/dashboard/locale/en-CA/definitions.php (there are a lot of definitions in here so it's what I would assume, but there are 7 different files named "definitions", such as applications/conversations/locale/en-CA/definitions.php)

    I appreciate your help in putting this together!

  • peregrineperegrine MVP
    edited September 2015

    the easiest way to change or add definitions on the fly is via /conf/locale.php
    the added plus is it won't get overwritten when you upgrade.

    if it doesn't exist create it.
    you could change your /conf/locale.php by adding definitions to it.

    e.g.

    <?php if (!defined('APPLICATION')) exit();
    $Definition['Online Now'] = 'Online Recently';

    http://vanillaforums.org/discussion/26597/tutorial-how-to-change-wording-how-to-change-text-how-to-change-language-how-to-change-locale/p1

    you could add it to a locale you downloaded as well. But that could get overwritten as well, that's why I suggest /conf/locale.php

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • I was able to work around the problem by changing this:

                    <h4><?php echo T("Online Now"); ?> (<?php echo $this->_OnlineUsers->NumRows(); ?>)</h4>
    

    to:

                    <h4><?php echo ("Recently Online"); ?> (<?php echo $this->_OnlineUsers->NumRows(); ?>)</h4>
    

    and everything is working perfectly. Thanks, you're a genius! :):)

  • peregrineperegrine MVP
    edited September 2015

    not a good idea! to change T() translations in the code, when you can do it without changing code.

    That is why I suggested definitions.

    see the tutorial link

    http://vanillaforums.org/discussion/26597/tutorial-how-to-change-wording-how-to-change-text-how-to-change-language-how-to-change-locale/p1

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    I will add the changes to the plugin as soon as I have a chance

  • @peregrine

    I added the T back and created the conf/locale.php file with the definition. Thanks again

Sign In or Register to comment.