vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin Forum Sideblocks - Block - Users Online (https://vborg.vbsupport.ru/showthread.php?t=233965)

Big-K 10-19-2012 11:37 AM

Lynne,

I'm on 4.2.0, I've followed every instruction twice, disabled all hooks and still can't get this to show. All I see is "Array". Any more ideas? Can I PM you my site details?

Lynne 10-19-2012 04:18 PM

Quote:

Originally Posted by Big-K (Post 2374230)
Lynne,

I'm on 4.2.0, I've followed every instruction twice, disabled all hooks and still can't get this to show. All I see is "Array". Any more ideas? Can I PM you my site details?

Did you follow the instructions for 4.2.0? I just reinstalled it on my 4.2.0 install using the instructions in the text file and it shows up just fine.

Big-K 10-20-2012 07:12 AM

Quote:

Originally Posted by Lynne (Post 2374288)
Did you follow the instructions for 4.2.0? I just reinstalled it on my 4.2.0 install using the instructions in the text file and it shows up just fine.

I just took all the steps again, no progress. I'll PM you my details please

Big-K 10-20-2012 03:34 PM

Update:

Thank you, Lynne The Great

In case anyone has issues, make sure to put in the name of the custom template in the block configuration page (Template To Use). That's the part I missed - Think that should be added to the instructions.

Does anyone know how to make this into Avatars?

Lynne 10-20-2012 04:32 PM

Quote:

Originally Posted by Big-K (Post 2374545)
Update:

Thank you, Lynne The Great

In case anyone has issues, make sure to put in the name of the custom template in the block configuration page (Template To Use). That's the part I missed - Think that should be added to the instructions.

It is in the instructions:

Quote:

3) Configure the Block
Now go to forums & Moderators > Forum Block Manager > Add Block
Select Block Type - Custom HTML/PHP
CONTINUE
Title - Users Online
Cache Time (in minutes) - 1 (default is 60 minutes)
Active - Yes
Content Type - PHP
Template to Use - block_users_online
Content -

if (THIS_SCRIPT != 'index') {
require_once(DIR . '/includes/functions_bigthree.php');
rest of code removed....

oldz442 10-20-2012 07:57 PM

1 Attachment(s)
Quote:

Originally Posted by oldz442 (Post 2363022)
Can I add a fetch_avatar_url($userid) to the block code somewhere? I want to display a clickable mini avatar, 4 per row similar to below. I am using file based avatars. thx

bump

Mark.B 10-20-2012 08:06 PM

Quote:

Originally Posted by oldz442 (Post 2363022)
Can I add a fetch_avatar_url($userid) to the block code somewhere? I want to display a clickable mini avatar, 4 per row similar to below. I am using file based avatars. thx

In the block code you would add this:

PHP Code:

// AVATAR

require_once(DIR '/includes/functions_user.php');
 
$loggedin['avatarurl'] = fetch_avatar_url($loggedin['userid']);
     if (!
$loggedin['avatarurl']) {
                    
$loggedin['avatarurl'] = 'images/misc/unknown.png';
                  } else {
                    
$loggedin['avatarurl'] = $loggedin['avatarurl'][0];
                  }


// AVATAR 

Then you can call it with {vb:raw loggedin.avatarurl}.

However you'll need to account for the fact as it stands you'll just get a long line of avatars; you need something in the template code to make them wrap after 4 avatars.

Also bear in mind this adds 1 query per avatar.

Big-K 10-20-2012 09:42 PM

Quote:

Originally Posted by Mark.B (Post 2374605)
In the block code you would add this:

PHP Code:

// AVATAR

require_once(DIR '/includes/functions_user.php');
 
$loggedin['avatarurl'] = fetch_avatar_url($loggedin['userid']);
     if (!
$loggedin['avatarurl']) {
                    
$loggedin['avatarurl'] = 'images/misc/unknown.png';
                  } else {
                    
$loggedin['avatarurl'] = $loggedin['avatarurl'][0];
                  }


// AVATAR 

Then you can call it with {vb:raw loggedin.avatarurl}.

Mark, Where exactly do you add this in the block code and how do you call it?

Lynne 10-20-2012 11:38 PM

You could rewrite the query that gets the users online and JOIN with the avatar table and get the avatar that way and then you don't get an extra query per user for the avatar. (Check the query for the post user since that query grabs and avatar for the user.)

Big-K 10-23-2012 11:31 AM

Lynne - Is it possible for you to help create a code for those who want Avatars like Mark.B's?

Lynne 10-23-2012 04:02 PM

I don't have time to look into do a rewrite here.

Big-K 10-24-2012 03:57 PM

Thanks. Here's What I did to show Avatars. The only snag is that nothing is shown for users with no avatars. Hope someone can clean it up.

I changed
Code:

<a class="username" href="{vb:link member, {vb:raw loggedin}}">{vb:raw loggedin.musername}</a>
to
Code:

            <a class="username" href="{vb:link member, {vb:raw loggedin}}">
<vb:if condition=$loggedin['avatarurl']>
<img src="image.php?u={vb:raw loggedin.userid}" alt="{vb:raw loggedin.musername}" />
<vb:else />
<img class="avback" src="{vb:stylevar imgdir_misc}/unknown.gif" alt="{vb:raw loggedin.musername}" />
</vb:if></a>


Mark.B 10-24-2012 05:13 PM

Your second <img> tag (after the <else> tag) needs to point to wherever your "unknown.png" or "unknown.gif" avatar is - whatever image you want showing up for people with no avatars basically.

Big-K 10-25-2012 08:11 AM

Quote:

Originally Posted by Mark.B (Post 2375693)
Your second <img> tag (after the <else> tag) needs to point to wherever your "unknown.png" or "unknown.gif" avatar is - whatever image you want showing up for people with no avatars basically.

You're right and I've edited accordingly. The issue though is that the "<vb:if condition=$loggedin['avatarurl']>" syntax doesn't work due to incorrect placement of the block code. Could you please respond to my post #209?

patracy 12-15-2012 05:33 PM

Can't seem to get this to display on my forum at all. I'm using 4.2.0 and used the instructions in the files step by step. Simply nothing displayed at all in my sidebar.

Lynne 12-15-2012 05:50 PM

Did you make sure to change the template name and also create the custom template? And did you add the widget to the layout?

Amaury 02-05-2013 06:14 AM

How I can get "X members and Y guests" on the same line as "There are currently X members online"? I was increasing forum_sidebar_width for something else and noticed nothing changed in that.

I'm assuming you have line breaks somewhere by default?

Lynne 02-05-2013 03:58 PM

Quote:

Originally Posted by Amaury25 (Post 2402020)
How I can get "X members and Y guests" on the same line as "There are currently X members online"? I was increasing forum_sidebar_width for something else and noticed nothing changed in that.

I'm assuming you have line breaks somewhere by default?

Remove the <br /> in here:
HTML Code:

<p>{vb:rawphrase there_are_x_online, {vb:raw content.totalonline}}
<br /><span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw content.numberregistered}, {vb:raw content.numberguest}}</span></p>


Amaury 02-05-2013 04:15 PM

Quote:

Originally Posted by Lynne (Post 2402114)
Remove the <br /> in here:
HTML Code:

<p>{vb:rawphrase there_are_x_online, {vb:raw content.totalonline}}
<br /><span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw content.numberregistered}, {vb:raw content.numberguest}}</span></p>


Thanks, Lynne. Removed it. :)

By the way, you made a slight mistake in that code above at the beginning.

Should be: {vb:rawphrase there_are_x_online_link,

Amaury 02-13-2013 05:18 PM

I actually reverted that change because it was causing problems with our thread titles not staying on one line, and I didn't want to trim titles lower than 20 (default is 30).

However, now I also want to line break the most visitors to reduce the sidebar width even more to hopefully restore the title trimming to the default 30.

I tried adding a <br />, but it made this:
Quote:

Most users ever online was 118, 9/11/2012 at 4:16 AM.
...look like this:

Quote:

Most users ever online was 118,
at 9/11/2012.
I also want to add spacing in-between.

Instead of this:

Quote:

There are currently X users online.
X members and X guests
Most users ever online was 118
9/11/2012 at 4:16 AM.
User 1, User 2, User 3
...it would look like this:

Quote:

There are currently X users online.
X members and X guests

Most users ever online was 118
9/11/2012 at 4:16 AM.

User 1, User 2, User 3
Thanks in advance.

Lynne 02-13-2013 05:27 PM

You would just add an extra <br /> where you want an extra line.
HTML Code:

                <br /><span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw content.numberregistered}, {vb:raw content.numberguest}}</span><br /></p>
                <p>{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw content.recordusers}, {vb:raw content.recorddate}, {vb:raw content.recordtime}}<br /></p>


Amaury 02-13-2013 09:55 PM

Quote:

Originally Posted by Lynne (Post 2404052)
You would just add an extra <br /> where you want an extra line.
HTML Code:

                <br /><span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw content.numberregistered}, {vb:raw content.numberguest}}</span><br /></p>
                <p>{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw content.recordusers}, {vb:raw content.recorddate}, {vb:raw content.recordtime}}<br /></p>


Hm. I tried that, and it didn't work.

Lynne 02-14-2013 12:30 AM

Then add two of them instead of one.

Amaury 02-14-2013 02:13 AM

Quote:

Originally Posted by Lynne (Post 2404123)
Then add two of them instead of one.

Like so? :)

Quote:

<br /><span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw content.numberregistered}, {vb:raw content.numberguest}}</span><br /></p>
<br /><p>{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw content.recordusers}, {vb:raw content.recorddate}, {vb:raw content.recordtime}}<br /></p>

Lynne 02-14-2013 04:45 PM

I would put it with the others I had added:
Code:

                <br /><span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw content.numberregistered}, {vb:raw content.numberguest}}</span><br /><br /></p>
                <p>{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw content.recordusers}, {vb:raw content.recorddate}, {vb:raw content.recordtime}}<br /><br /></p>


Amaury 02-14-2013 05:25 PM

Quote:

Originally Posted by Lynne (Post 2404261)
I would put it with the others I had added:
Code:

                <br /><span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw content.numberregistered}, {vb:raw content.numberguest}}</span><br /><br /></p>
                <p>{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw content.recordusers}, {vb:raw content.recorddate}, {vb:raw content.recordtime}}<br /><br /></p>


Not sure if I did exactly that, but I ended up doing this:
Code:

<br /><span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw content.numberregistered}, {vb:raw content.numberguest}}</span></p>
                <p><br />{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw content.recordusers}, {vb:raw content.recorddate}, {vb:raw content.recordtime}}</p>
                <br /><ol class="commalist">
                    <vb:each from="content.activeusers" value="loggedin">

As for the most users, I just edited the phrase most_users_ever_online_was_x_y_at_z and made it this:
Code:

Most users ever online was {1}. <br />{2} at <span class="time">{3}</span>.

Lee Roberts 03-10-2013 12:20 PM

Thanks for this Lynne!

Anyone using the Sidebar Anywhere by BOP5 if you want this block to work on other pages follow the steps below:

REPLACE TEMPLATE CODE:

Code:

<vb:if condition="$show['loggedinusers']">
<li>
    <div class="block smaller">
        <div class="blocksubhead">
            <a class="collapse" id="collapse_block_html" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html"/></a>
            <span class="blocktitle"><img src="{vb:stylevar imgdir_misc}/users_online.png" alt="{vb:rawphrase currently_active_users}" />{vb:rawphrase currently_active_users}</span>
        </div>
        <div id="block_html" class="blockbody floatcontainer">
            <div class="blockrow">
                <p>{vb:rawphrase there_are_x_y_online_link, {vb:raw content.totalonline}, {vb:raw session.sessionurl_q}}
                <br /><span class="shade">{vb:rawphrase x_members_and_y_guests, {vb:raw content.numberregistered}, {vb:raw content.numberguest}}</span></p>
                <p>{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw content.recordusers}, {vb:raw content.recorddate}, {vb:raw content.recordtime}}</p>
                <ol class="commalist">
                    <vb:each from="content.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>
            </div>
        </div>
    </div>
    <div class="underblock"></div>
</li>
</vb:if>



WITH:

Code:

<li>
    <div class="block smaller">
        <div class="blocksubhead">
            <a class="collapse" id="collapse_block_html" href="{vb:raw  relpath}#top"><img alt="" src="{vb:stylevar  imgdir_button}/collapse_40b.png" id="collapseimg_html"/></a>
            <span class="blocktitle"><img src="{vb:stylevar  imgdir_misc}/users_online.png" alt="{vb:rawphrase  currently_active_users}" />{vb:rawphrase  currently_active_users}</span>
        </div>
        <div id="block_html" class="blockbody floatcontainer">
            <div class="blockrow">
                <p>{vb:rawphrase there_are_x_y_online_link, {vb:raw content.totalonline}, {vb:raw session.sessionurl_q}}
                <br /><span class="shade">{vb:rawphrase  x_members_and_y_guests, {vb:raw content.numberregistered}, {vb:raw  content.numberguest}}</span></p>
                <p>{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw  content.recordusers}, {vb:raw content.recorddate}, {vb:raw  content.recordtime}}</p>
                <ol class="commalist">
                    <vb:each from="content.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>
            </div>
        </div>
    </div>
    <div class="underblock"></div>
</li>

.Me

Lynne 03-10-2013 05:14 PM

Thanks for posting that Lee Roberts.

justicechick 11-26-2013 03:11 AM

Hi Lynn, I have attempted this twice. I correctly followed all the steps to the best of my knowledge and the block shows up on my page. It was minus the actual numbers of online users ect. However my bigger issue is that as soon as I enable the plugin I get this errror code at the top of my header. BTW I am running 4.2.2

Parse error: syntax error, unexpected 'is' (T_STRING) in /home/cafeflir/public_html/includes/class_bootstrap.php(1419) : eval()'d code on line 145

Warning: Cannot modify header information - headers already sent by (output started at ..../includes/class_bootstrap.php(1419) : eval()'d code:145) in ..../includes

Lynne 11-26-2013 05:32 PM

Quote:

Originally Posted by justicechick (Post 2463769)
Parse error: syntax error, unexpected 'is' (T_STRING) in /home/cafeflir/public_html/includes/class_bootstrap.php(1419) : eval()'d code on line 145

That is an error with the caching of the template. But, there is no "is" in the block_users_online template. Could you have accidentally added a line break in the middle of a word? Did you remember to enter that template under "Template to Use" in the Block configuration page?

justicechick 11-27-2013 04:52 AM

Quote:

Originally Posted by Lynne (Post 2463891)
That is an error with the caching of the template. But, there is no "is" in the block_users_online template. Could you have accidentally added a line break in the middle of a word? Did you remember to enter that template under "Template to Use" in the Block configuration page?

Thanks Lynn, I tried it again but unfortunately its still a no go. My blocks have started appearing under my forumhome for some reason so Im checking on that and wondering if it might be the course of the problem. I will post back here once I get that figured out and have tried creating the block again .

https://vborg.vbsupport.ru/external/2013/11/1.png?1

justicechick 12-07-2013 04:17 PM

I finally got this to appear but purely accidental. I tried reinstalling it again and still got the prior error so I was gonna uninstall it. I removed the plugin I had created and got side tracked removing the rest . When I looked at my forum home page I saw it there. So it ended up working without that plugin mentioned in the install. Could it be using another plugin that was already installed?

Lynne 12-07-2013 07:16 PM

The plugin for this is only to cache the template. You really don't need the plugin in order for this to work at all, it is just good to cache your templates.

Frosti 01-31-2015 10:28 PM

Lynne, Wouldn't it just be a simple code change if you wanted this to show only certain usergroups... thus turning it into say a STAFF ONLINE.

I know about the 'staff online' block but that doesn't work for me, I would love to give this one a try and just add a code change to show only specific usergroups 'online'

Lynne 02-01-2015 07:12 PM

Quote:

Originally Posted by Frosti (Post 2535457)
Lynne, Wouldn't it just be a simple code change if you wanted this to show only certain usergroups... thus turning it into say a STAFF ONLINE.

I know about the 'staff online' block but that doesn't work for me, I would love to give this one a try and just add a code change to show only specific usergroups 'online'

Sure. You could add a JOIN to the query to grab the users usergroup and then only output online users in a certain usergroup.


All times are GMT. The time now is 01:54 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01569 seconds
  • Memory Usage 1,868KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (4)bbcode_html_printable
  • (2)bbcode_php_printable
  • (21)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete