News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

mod_smf_online2 question

Started by dbrown, October 31, 2006, 12:54:17 PM

Previous topic - Next topic

dbrown

Orstio/Kindred (or whoever can help me out:

I have modded smf_smf_online2 to show this at the top of the module:

Currently, there are 46 visitors
online: 29 Guests and 17 Users


However, when a user is not logged in they see:

Currently, there are 0 visitors
online: 29 Guests and 17 Users


Here's the original code, and my modded code. If someone could help me out with getting it to show the total number of visitors to guests, not just logged in members, that'd be great!

ORIGINAL:
// parameter
$smf_wio['text'] = $params->get( 'smf_wio_text' ); // output text
$smf_wio['guests'] = $params->get( 'smf_wio_guests' );
$smf_wio['hidden'] = $params->get( 'smf_wio_hidden' );
$smf_wio['list'] = $params->get( 'smf_wio_list' );
$smf_wio['position'] = $params->get( 'smf_wio_position' );
$smf_wio['spacer'] = $params->get( 'smf_wio_spacer' );



MODDED:
// parameter
echo '
Currently, there are <strong>', $context['show_who']? ' ' : '', ($context['num_users_online'] + $context['num_guests']),'</strong> visitors online:';
$smf_wio['text'] = $params->get( 'smf_wio_text' ); // output text
$smf_wio['guests'] = $params->get( 'smf_wio_guests' );
$smf_wio['hidden'] = $params->get( 'smf_wio_hidden' );
$smf_wio['list'] = $params->get( 'smf_wio_list' );
$smf_wio['position'] = $params->get( 'smf_wio_position' );
$smf_wio['spacer'] = $params->get( 'smf_wio_spacer' );
Please do not PM me with support questions.  You will get better and faster responses by contacting someone who has a clue. Thank you.

dbrown

#1
I take it all back!!!

It only appears to work if you are looking at the board index. It doesn't seem to work on any other pages.

RC3
1.1.6
Joomla 1.0.11
Please do not PM me with support questions.  You will get better and faster responses by contacting someone who has a clue. Thank you.

Kindred

you can't just throw code in anywhere in the file...   You added that echo before the function is even defined!

where you placed that code... the system has not yet COUNTED the online people...
It works on the pages where board index is showing because boardindex runs a similar code and populated the variables.

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

dbrown

I see. Where should I put the code?
Please do not PM me with support questions.  You will get better and faster responses by contacting someone who has a clue. Thank you.

Kindred

I don't have the code in front of me at the moment, but I would suggest you look closer to the bottom of the file...  Most of the echo statements don't get run until all of the values have been calculated.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

dbrown

I tried making it the last bit of code in the file. I displayed at the bottom of the module, but still said "0". Anyway, if you have a moment later to see how this could be accomplished, that'd be great. Thanks
Please do not PM me with support questions.  You will get better and faster responses by contacting someone who has a clue. Thank you.

dbrown

I think using the method I'm using won't work period. Is there another way to add the total # of users/guests and display it?
Please do not PM me with support questions.  You will get better and faster responses by contacting someone who has a clue. Thank you.

dbrown

Sorry to bump, but I'm totally stuck as to how to accomplish this. It seems simple enough to do, but those are always the prjects that stump me!
Please do not PM me with support questions.  You will get better and faster responses by contacting someone who has a clue. Thank you.

Advertisement: