PDA

View Full Version : How to display online users/guests on cms homepage?


Guido64
04-11-2016, 09:18 AM
I'm using vb 4.2 and would like to display the amount of online users/guest in a cms article on the cms home. My forum is closed for guest users so they can't view it there. How can i accomplish this?

Budget101
04-14-2016, 10:26 AM
Not positive it would work, but at the very least you would need to grab that bit of code from the bottom of the ForumHome Template and plug it into a template in the CMS depending on where you wanted it to appear. Keep in mind that it adds an extra call on the database which will slow loading times.

<vb:if condition="$show['guest']">
<!-- logged-in users -->
<div id="wgo_onlineusers" class="wgo_subblock section">
<h3 class="blocksubhead"><img src="{vb:stylevar imgdir_misc}/users_online.png" alt="{vb:rawphrase currently_active_users}" />{vb:rawphrase currently_active_users}</h3>
<div>
<p>{vb:rawphrase there_are_x_y_online_link, {vb:raw totalonline}, {vb:raw session.sessionurl_q}} <span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw numberregistered}, {vb:raw numberguest}}</span></p>
<p>{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw recordusers}, {vb:raw recorddate}, {vb:raw recordtime}}</p>
<vb:if condition="$activeusers">
<ol class="commalist" id="wgo_onlineusers_list">
<vb:each from="activeusers" value="loggedin">
<li>{vb:stylevar dirmark}<a class="username" href="{vb:link member, {vb:raw loggedin}}">{vb:raw loggedin.musername}</a>{vb:raw loggedin.invisiblemark}{vb:raw loggedin.buddymark}{vb:raw loggedin.comma}</li>
</vb:each>
</ol>
</vb:if>
</div>
</div>
<!-- end logged-in users -->

--------------- Added 1460636991 at 1460636991 ---------------

AActually in looking at it further, you'd probably have to include the hook as well {vb:raw template_hook.forumhome_wgo_pos1}

Guido64
04-14-2016, 04:03 PM
Great, thank you Budget101 i'm going to fiddle with your tip. If it works i let you and everybody know if if worked or not.