TinyPortal

Development => Block Codes => Topic started by: Dragooon on July 27, 2007, 04:35:06 PM

Title: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: Dragooon on July 27, 2007, 04:35:06 PM
Hello,

Saw some unfilled requests so I decided to fulfill it. The requests were about using the mod Users Online today (http://custom.simplemachines.org/mods/index.php?mod=217) and make a block to show the thing it shows under Users Online on Board Index(Means where the board names are located not the TP Users online today block).

So I made a code to make it work.
P.S. I used the code it uses in BoardIndex.template.php(Modified it a bit to make it work in blocks).

NOTE:It works with left/right/center blocks.
NOTE:You must have Users online today mod (http://custom.simplemachines.org/mods/index.php?mod=217) installed

Tested with TP 0.9.8 with Usersn Online today v 1.4.0
Update!
- Made it to call Modifications.english.php file from the default directory because of some theme's custom Modifications.english.php usage

Insert the fol code in a php Block
//Users online today block by Dragooon
//Uses the mod User Online today by Carceri
//No Credits to Dragooon since I used the template from BoardIndex.template.php
//Works on Right/Left/Center Blocks
global $boarddir, $txt, $context, $settings, $scripturl;
require($boarddir . 'Themes/default/languages/Modifications.english.php');
echo ' ', $txt['uot_users_online_today'], '

<img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt['uot_users_online_today'], '" border="0" />
';
 
echo $txt['uot_total'], ': <b>', $context['num_users_online_today'], '</b>';
  if (!$context['user']['is_guest'])
  echo ' (', $txt['uot_visible'], ': ', ($context['num_users_online_today'] - $context['num_hidden_users_online_today']), ', ', $txt['uot_hidden'], ': ', $context['num_hidden_users_online_today'], ')';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online_today']) && !$context['user']['is_guest'])
echo '<br />', implode(', ', $context['list_users_online_today']);

echo '
<br />', $context['show_stats'] && !$settings['show_sp1_info'] ? '
<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
' ;


Hope you like it.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)
Post by: jdvarner on July 29, 2007, 05:55:28 AM
This is what i get:

: (: 0, : )

Seriously.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)
Post by: Dragooon on July 29, 2007, 06:44:25 AM
This block is working with me good.
Make sure you got the mod installed.
I just updated it and made it call Mdifications.english.php from the default directory, It may now work.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: wilsy on July 29, 2007, 09:29:22 AM
Hi Dragoon,

Nothing for me either, this is what I get: -

Users Logged In Today (ICON)  Total:  (Visible: 0, Hidden: )

Regards,

Wilsy.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: Dragooon on July 29, 2007, 10:16:10 AM
This uses the Users Online today mod.
So it is its fault not mine.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: wilsy on July 29, 2007, 10:40:02 AM
Hi Dragoon,

I have the mod installed and I wasn't saying it was your fault - I love it so much I just want it to work, that's all  ;)

Regards,

Wilsy.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: Dragooon on July 29, 2007, 11:17:13 AM
This is based on the mod.
So what the mod will show it will show.I cant really help in that.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: jacortina on July 29, 2007, 02:25:09 PM
See if any errors are being thrown (check your forum error log).

I don't see any 'global' statement in the code, so all those variables/arrays may be undefined at parse time.

Adding this at the top might help:

global $boarddir, $txt, $context, $settings, $scripturl;
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: Dragooon on July 29, 2007, 02:52:36 PM
So that was missing :P
I forgot to add globals I am sorry about that.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: wilsy on July 29, 2007, 03:49:20 PM
Thanks for all your efforts, they're appreciated.

The script now causes an error as below: -

Fatal error: Unknown: Failed opening required '/home/rewindla/public_html/forumThemes/default/languages/Modifications.english.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/rewindla/public_html/forum/Sources/Load.php(1792) : eval()'d code(35) : eval()'d code on line 6

Sorry to be a pain, would love to get this one working.

Regards,

Wilsy.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: jacortina on July 29, 2007, 03:56:18 PM
Try changing:
require($boarddir . 'Themes/default/languages/Modifications.english.php');

To:
require($boarddir . '/Themes/default/languages/Modifications.english.php');


Or let SMF load it by replacing that line with:
loadLanguage('Modifications');
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: wilsy on July 29, 2007, 04:08:42 PM
Thanks JA,

Still no luck, this is the result: -

(https://www.tinyportal.net/index.php?action=dlattach;topic=17742.0;attach=11515;image)

With these in the error logs: -

8: Undefined index: lang_locale
/home/rewindla/public_html/forum/Sources/Subs.php
868

8: Undefined index: smf10b
/home/rewindla/public_html/forum/Sources/Subs.php
863

I have attached my subs.php and Modifications.english.php files in case it's of any use.

Thanks to both of you for your help, it's very appreciated.

Regards,

Wilsy.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: jacortina on July 29, 2007, 04:31:05 PM
This is obviously getting processed brfore some critical pieces are getting parsed, because those two errors refer to the lack of a definition for two entries which are given in the index.<language>.php file.

So, you can try to add this line right before the require/loadLanguage mentioned in the last message:
loadLanguage('index');
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: wilsy on July 29, 2007, 05:07:28 PM
Thanks again JA,

Still no luck though  :(

It's a real pity because I've just reworked the site a little and this block would come in real handy.

Regards,

Wilsy.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: jdvarner on August 05, 2007, 04:22:50 PM
Hey Wilsy, just wanted too see if you ever got it working? i tried all the tips in this thread as well and still get errors such as you posted. Only asking ya, because you seem to be actively trying to get it to work.

jd
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: wilsy on August 05, 2007, 04:37:54 PM
No, unfortunatey not  :(

It's a real pity as I have this: -

echo '<img src="'.$settings['actual_images_url'].'/icons/online.gif'.'"  /> <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br>
<span class="smalltext">';
ssi_whosOnline();
echo '</span>';


...in a centre block showing Users Currently Online and it would have been very nice to have the Users Online Today block below it.

Regards,

Wilsy.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: jdvarner on August 05, 2007, 04:53:41 PM
that would be cool. maybe even a combined block as well seperated by a line or something.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: wilsy on August 07, 2007, 10:02:29 PM
I totally agree!

I'm sure one of the coding guru's will be along soon ;)

Regards,

Wilsy.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: FUBAR on August 11, 2007, 10:38:52 AM
Wouldn't this do the job?

In a PHP Block (Left, right or center) add:
require("SSI.php");

ssi_whosOnline_today();


I've attached examples below, ;)

Hope this works.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: jdvarner on August 11, 2007, 02:23:44 PM
i got a fatal error and i do have the whos online today moday installed.

wilsy, it work for you?
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: IchBin on August 11, 2007, 04:05:03 PM
what was the error?
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: jdvarner on August 11, 2007, 05:08:24 PM
Fatal error: Call to undefined function: ssi_whosonline_today() in /home/content/j/d/w/jdworld/html/Sources/Load.php(1759) : eval()'d code(35) : eval()'d code on line 3
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: IchBin on August 11, 2007, 07:11:50 PM
That would be because you either don't have the mod installed, or the mod did not modify the SSI.php file properly. You'll need to ask the mod author for more help on this issue.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: wilsy on August 12, 2007, 10:05:21 AM
I get this: -

Fatal error: Cannot redeclare ssi_shutdown() (previously declared in /home/rewindla/public_html/forum/SSI.php:188) in /home/rewindla/public_html/forum/SSI.php on line 190

Although I haven't tried I think it would work in the block whilst you are in the forum. I need to use the code in a front page block.

Regards,

Wilsy.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: darthi8nt on August 14, 2007, 06:18:08 AM
you have a duplicate line of the same code delete one of the duplicates.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: npereira on August 17, 2007, 02:48:23 AM
ok, I got it to work by installing the most users on-line mod, but found out that this PHP Block Code will only show the users if your in the forum, IE: /index.php?action=forum

If your in Tinyportal front end, it will not show anything.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: G6Cad on August 17, 2007, 05:05:13 PM
Thats because the mod apply to the SMF files in the default theme, it doesent apply to TP.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: FUBAR on August 18, 2007, 07:03:06 AM
Quote from: npereira on August 17, 2007, 02:48:23 AM
ok, I got it to work by installing the most users on-line mod, but found out that this PHP Block Code will only show the users if your in the forum, IE: /index.php?action=forum

If your in Tinyportal front end, it will not show anything.

I took those screen shots from my frontpage.   It should work fine.  ;)
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: tamasir on June 26, 2011, 07:52:31 AM
SMF version: SMF2.0
TP version: TP 1.0RC2
Default Forum Language: Hungarian
Theme name and version: Fire Rock (convert:Tinyportal-eu)
Links url Smf-Tinyportal test Site (http://www.smf-test.tinyportal.eu/)


Me you the tinyportal.net/forum  Users block code?
The user online today mod installed.
(I love Would shape my site so, would look  than the tinyportal.net side)
Thank you...
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: WillyP on June 27, 2011, 04:01:34 AM
Can you rephrase that?
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: tamasir on June 27, 2011, 05:43:33 PM
SMF version: SMF2.0
TP version: TP 1.0RC2
Default Forum Language: Hungarian
Theme name and version: Fire Rock (convert:Tinyportal-eu)
Links url Smf-Tinyportal test Site (http://www.smf-test.tinyportal.eu/)


I would like his code the tinyportal.net/forum Users block code?
The smf user online today mod my installed.
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.tinyportal.eu%2Fimg%2Fusers_tinyportal.net.jpg&hash=059bf35b39394aa00c7932773abc13e6e5ea7e75)
Thank you...
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: ZarPrime on June 28, 2011, 12:16:40 AM
tamasir,

That block you see at the bottom of the right panel on this site's BoardIndex is not actually a TinyPortal block.  In fact, if you were viewing it with a wider resolution screen, the title on it actually says "Users Logged In".  That whole panel that you see on the right side is actually the Info Center that's normally seen under the BoardIndex.  This particular theme we are using here has a feature that Bloc coded into it to allow the Info Center to be moved from the bottom to the right side.

So, in other words, we don't have the code for this, it's built into the theme.  Sorry about that.

ZarPrime
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: tamasir on June 28, 2011, 07:38:33 AM
ZarPrime
I say thank you for the guide to you very much.
Thanks Brad...
tamasir~
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: Xt on August 05, 2011, 08:20:44 PM
SMF version: 2.0
TP version: TP1RC2

I hadn't read all the post here , so just an FYI. 
I think the file names and locations have been changed with one of the latest Users online Today.
<name>Users Online Today</name>
<version>2.0 RC4</version>

I got the code snippet working with this.
Changed from original post.
require($boarddir . 'Themes/default/languages/Modifications.english.php');

To:
require($boarddir . '/Themes/default/languages/UsersOnlineToday.english.php');

Thanks
Xt.
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: Shadow on September 03, 2011, 04:58:06 AM
Do we have a updated code for this code?
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: Freddy on September 03, 2011, 01:40:11 PM
Hi Shadow this it not actually a block.

Read ZP's comment here : http://www.tinyportal.net/index.php?topic=17742.msg273195#msg273195
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: Shadow on September 03, 2011, 09:39:06 PM
Hello Freddy,

I do thank you for that info about this topic.

:)
Title: Re: Users online Today Block(Uses the mod called as Users online Today)[Updated]
Post by: MrCare on November 09, 2011, 04:41:52 PM
i found this mod http://custom.simplemachines.org/mods/index.php?mod=2369 .
How can we make users online in stats block using auto refresh?