solved Where would I find the code that dispays number of online users?

alt=
@oxotic
8 years ago
31 posts
Maybe something that looks like:
2 quota A's ONLINE, 55 quota B's ONLINE, 5 visitors ONLINE

Or anything that shows current online active users would be cool.
Thanks in advance!


updated by @oxotic: 07/04/16 09:53:11AM
douglas
@douglas
8 years ago
2,791 posts
The jrUser_whos_online functions is whats being used in other Jamroom skins:


{jrUser_whos_online template="whos_online.tpl"}

whos_online.tpl:
<div class="container">
{if isset($master)}
    <div class="row">
        <div class="col12 last">
            <span class="media_title">{jrCore_lang skin=$_conf.jrCore_active_skin id="37" default="Master"} {jrCore_lang skin=$_conf.jrCore_active_skin id="39" default="Admins"}</span>
            <hr>
        </div>
    </div>
    <div class="row">
        {foreach from=$master item="m_admin"}
            <div class="col3{if $m_admin@last} last{/if}">
                <div class="center capital p5">
                    <a href="{$jamroom_url}">{jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$m_admin.session_user_id size="xsmall" crop="auto" class="iloutline" alt=$m_admin.session_user_name title=$m_admin.session_user_name}</a>
                </div>
            </div>
        {/foreach}
    </div>
{/if}

{if isset($admin)}
    <div class="row">
        <div class="col12 last">
            <hr>
            <span class="media_title">{jrCore_lang skin=$_conf.jrCore_active_skin id="38" default="Site"} {jrCore_lang skin=$_conf.jrCore_active_skin id="39" default="Admins"}</span>
            <hr>
        </div>
    </div>
    <div class="row">
        {foreach from=$admin item="s_admin"}
            <div class="col3{if $s_admin@last} last{/if}">
                <div class="center capital p5">
                    <a href="{$jamroom_url}/{$s_admin.profile_url}">{jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$s_admin.session_user_id size="xsmall" crop="auto" class="iloutline" alt=$s_admin.session_user_name title=$s_admin.session_user_name}</a>
                </div>
            </div>
        {/foreach}
    </div>
{/if}

{if isset($user)}
    <div class="row">
        <div class="col12 last">
            <hr>
            <span class="media_title">{jrCore_lang skin=$_conf.jrCore_active_skin id="40" default="Members"}</span>
            <hr>
        </div>
    </div>
    <div class="row">
        {foreach from=$user item="member"}
            <div class="col3{if $member@last} last{/if}">
                <div class="center capital p5">
                    <a href="{$jamroom_url}/{$member.profile_url}">{jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$member.session_user_id size="xsmall" crop="auto" class="iloutline" alt=$member.session_user_name title=$member.session_user_name}</a>
                </div>
            </div>
        {/foreach}
    </div>
{/if}

</div>

<hr>

<div class="p3" style="width:90%;display:table;margin:0 auto;">

    <div style="display:table-row">

        <div class="capital bold" style="display:table-cell">
            {jrCore_lang skin=$_conf.jrCore_active_skin id="37" default="Master"} {jrCore_lang skin=$_conf.jrCore_active_skin id="39" default="Admins"}:
        </div>
        <div class="hl-3" style="width:1%;display:table-cell;;text-align:right;">
            {$master_count}
        </div>

    </div>

    <div style="display:table-row">

        <div class="capital bold" style="display:table-cell;">
            {jrCore_lang skin=$_conf.jrCore_active_skin id="38" default="Site"} {jrCore_lang skin=$_conf.jrCore_active_skin id="39" default="Admins"}:
        </div>
        <div class="hl-3" style="width:1%;display:table-cell;;text-align:right;">
            {$admin_count}
        </div>

    </div>

    <div style="display:table-row">

        <div class="capital bold" style="display:table-cell;">
            {jrCore_lang skin=$_conf.jrCore_active_skin id="40" default="Members"}:
        </div>
        <div class="hl-3" style="width:1%;display:table-cell;;text-align:right;">
            {$user_count}
        </div>

    </div>

    <div style="display:table-row">

        <div class="capital bold" style="display:table-cell;">
            {jrCore_lang skin=$_conf.jrCore_active_skin id="41" default="Visitors"}:
        </div>
        <div style="width:1%;display:table-cell;;text-align:right;">
            <span class="hl-3">{$visitor_count}</span>
        </div>

    </div>

</div>

<hr>

<div class="p3" style="width:90%;display:table;margin:0 auto;">

    <div style="display:table-row">

        <div class="capital bold" style="display:table-cell;">
            {jrCore_lang skin=$_conf.jrCore_active_skin id="70" default="Total"}:
        </div>
        <div class="hl-3" style="width:1%;display:table-cell;text-align:right;">
            {$all_count}
        </div>

    </div>

</div>

You may need to adjust the class on the div elements as this is from the MediaPro skin.

Hope this helps!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
Developer Networks
Developer Networks
@developer-networks
8 years ago
566 posts
I tried this to list a specific quota only {jrUser_whos_online quota_id=4} to show a a specific quota online however it did not work. Is this possible with the current functionality?

Thanks
paul
@paul
8 years ago
4,326 posts
Unfortunately not. Have just looked at the code and that smarty function doesn't support a quota parameter. The profile quota isn't passed to the template either so nothing can be done there either. Sorry.


--
Paul Asher - JR Developer and System Import Specialist
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
I've found that quota_id does work with jrUser_whos_online.

Take a look at the session_quota_id in the jr_jruser_session table to see who is online, then try filtering using those ids. Your template will need to be different to cope with a single quota.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
paul
@paul
8 years ago
4,326 posts
Thanks Steve - I just looked at the code. Didn't actually try it to see what else gets added in.


--
Paul Asher - JR Developer and System Import Specialist
michael
@michael
8 years ago
7,715 posts
did you try it in combination with what @douglas wrote?
{jrUser_whos_online quota_id=4 template="whos_online.tpl"}
Developer Networks
Developer Networks
@developer-networks
8 years ago
566 posts
Thanks Paul for having a look anyways, I appreciate your time :)

Thanks Steve you were right on with the session_quota_id
    // Get active session users
    $tmp = '';
    $tim = 900; // default to active in last 15 minutes
    if (isset($params['length']) && jrCore_checktype($params['length'], 'number_nz')) {
        $tim = intval($params['length'] * 60); //  override (in minutes)
    }
    $tbl = jrCore_db_table_name('jrUser', 'session');
    $req = "SELECT CONCAT_WS('_',session_user_ip,session_user_group) AS session_uniq, session_updated, session_user_id, session_quota_id, session_user_action FROM {$tbl} WHERE session_updated > (UNIX_TIMESTAMP() - {$tim})";
    if (isset($params['quota_id']) && jrCore_checktype($params['quota_id'], 'number_nz')) {
        $req .= " AND session_quota_id = '" . intval($params['quota_id']) . "'";
    }
    $req .= " GROUP BY session_uniq ORDER BY session_updated DESC";



From there I was able to understand that the quota_id was passed and in fact part of the function parameters


Thanks Michael. You were also right with passing the quota_id in the smarty Function like shown:
 {jrUser_whos_online quota_id=4 template="whos_online.tpl"} 
is correct.

So to get the functionality I needed it was pretty simple. Ill show you what I did in effort to help others.



Lets say the quota your trying to show is ID 3.
---> You can find your quota id in your ACP=>profiles=>tools=>quota_browser and its name is the Artist quota.


You create the smarty function with the quota_id parameters like this:
 {jrUser_whos_online quota_id=3 template="artist_online.tpl"}


Next I created the artist_online.tpl template
{if isset($user)}
    <div class="row">
        <div class="col12 last">
            <hr>
            <span class="media_title">Artist Online:</span>
            <hr>
        </div>
    </div>
    <div class="row">
        {foreach from=$user item="member"}
            <div class="col3{if $member@last} last{/if}">
                <div class="center capital p5">
                    <a href="{$jamroom_url}/{$member.profile_url}">{jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$member.session_user_id size="xsmall" crop="auto" class="iloutline" alt=$member.session_user_name title=$member.session_user_name}</a>
                </div>
            </div>
        {/foreach}
    </div>
{/if}

And its working. Thanks everyone for the help! :)
updated by @developer-networks: 04/02/16 09:01:43AM

Tags