News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Users Online Today Mod

Started by Nibogo, November 06, 2005, 01:42:31 AM

Previous topic - Next topic

JimM

Those files are not required for 1.1.7 which uses version 1.4.0 of the mod.
Jim "JimM" Moore
Former Support Specialist

darkon

Ahhh...

OK, i accidently opened the manual instructions for the 2.0RC4....


Works perfectly now. :D

katb

i am using smf  1.1.7 when i try to install package manager it is showing following error

Error in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.

Type     Action     Description
1.    Execute Modification    ./Sources/BoardIndex.php    Test failed
2.    Execute Modification    ./Themes/default/BoardIndex.template.php    Test failed


after this i tried manual installation i tried to $context += getMembersOnlineStats($membersOnlineOptions); in ./Sources/BoardIndex.php , but i am not able to see this , as per manual installation it is showing add some lines after this variable, but i can't . Any help appreciated . Thanks in advance .

JimM

@katb - you are using the wrong file.  Be sure when you use the parser you click the 1.4.0 file for 1.1.7.  If you are seeing those statements you are parsing 1.5.4 which is for 2.0 Beta 4.
Jim "JimM" Moore
Former Support Specialist

Final60

Hey

I've tried editing my custom themes boardindex.template but it doesn't contain the markup that the mod wants to find and then replace.

Quote

Find:

   // Users online today
   echo '
         <div class="infocenter_section">
            <h4 class="headerpadding titlebg">', $txt['uot_users_online_today'], '</h4>
            <div class="windowbg">
               <p class="section">
                  <img src="', $settings['images_url'], '/icons/online.gif', '" alt="', $txt['uot_users_online_today'], '" />
               </p>
               <div class="windowbg2 sectionbody">
                  <div class="smalltext">';
   echo
                     $txt['uot_total'], ': <b>', $context['num_users_online_today'], '</b>';

                     if ($context['viewing_allowed'])
   echo
                     ' (', $txt['uot_visible'], ': ', ($context['num_users_online_today'] - $context['num_users_hidden_today']), ', ', $txt['uot_hidden'], ': ', $context['num_users_hidden_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['viewing_allowed'])
                     {
   echo          '<br />', implode(', ', $context['list_users_online_today']);

                        // Showing membergroups?
                        if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
   echo          '<br />[' . implode(']&nbsp;&nbsp;[', $context['membergroups']) . ']';
                     }
   echo '
                  </div>
               </div>
            </div>
         </div>';

         // If they are logged in, but statistical information is off... show a personal message bar.


Quote
Replace: // If they are logged in, but statistical information is off... show a personal message bar.



Would someone mind editing the attached custom theme boardindex.template file?

Just to add this mod works perfectly for the default theme!

JimM

Jim "JimM" Moore
Former Support Specialist

Final60

Thanks JimM, that worked a treat. you can see it on my forum :)

smldmr

is it possible to add the number of daily online users in the site statistics? For example, if a new day is beginning, the number is 0 and i can't see how many people was online yesterday (or any day before).

-SyN-

is it possible to be able to view the users online as a guest?

JimM

@smldmr - The mod was designed to display users online today.  Maybe the mod author will address that as an option but it is not currently supported. 

@ -SyN- - Try this, in your ./Themes/default/BoardIndex.template.php.  Backup your file before making the changes.

Find
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'], ')';


Remove this line:
if (!$context['user']['is_guest'])
Jim "JimM" Moore
Former Support Specialist

-SyN-

OK it went from this;

Total: 18


to this:

Total: 18 (Visible: 17, Hidden: 1)

Is there a way to get the names of the users to show as well?

JimM

Ok try this:

Find
// 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']);


Replace with this:

// 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'])
      echo '<br />', implode(', ', $context['list_users_online_today']);

Jim "JimM" Moore
Former Support Specialist

-SyN-

it returned with an error,

QuoteParse error: syntax error, unexpected '!', expecting '(' in .../Themes/XDEquinoxG1/BoardIndex.template.php on line 750

741:       <td class="row111" width="100%">';
742:
743:    echo '
744:          <div class="smalltext">';
745:
746:   echo $txt['uot_total'], ': <b>', $context['num_users_online_today'], '</b>';
747:      echo ' (', $txt['uot_visible'], ': ', ($context['num_users_online_today'] - $context['num_hidden_users_online_today']), ', ', $txt['uot_hidden'], ': ', $context['num_hidden_users_online_today'], ')';
748:
749:    // Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.

750:    if !empty($context['users_online_today'])

751:       echo '<br />', implode(', ', $context['list_users_online_today']);
752: echo '
753:             <br />', $context['show_stats'] && !$settings['show_sp1_info'] ? '
754:             <a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '

JimM

Delete that entire line.  Line 750 was where the check was to see it the user was a guest.
Jim "JimM" Moore
Former Support Specialist


Cuko

Quote from: katb on November 22, 2008, 08:43:08 AM
i am using smf  1.1.7 when i try to install package manager it is showing following error

Error in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.

Type     Action     Description
1.    Execute Modification    ./Sources/BoardIndex.php    Test failed
2.    Execute Modification    ./Themes/default/BoardIndex.template.php    Test failed


after this i tried manual installation i tried to $context += getMembersOnlineStats($membersOnlineOptions); in ./Sources/BoardIndex.php , but i am not able to see this , as per manual installation it is showing add some lines after this variable, but i can't . Any help appreciated . Thanks in advance .

I'm having the same problem.

I know nothing about PHP coding but I've noticed that the line that me and katb are looking for starts with "$context +=" and nowhere in the file can be found code that has "+=" after "$context".

Maybe the tutorial we are using (http://modparser.dev.dansoftaustralia.net/index.php [nofollow]) is outdated and uses some older version of PHP?

As I said I know nothing about PHP.

Any pointers on what should I do?

Where to paste the code?
// Get the user online today list.
require_once($sourcedir . '/Subs-MembersOnlineToday.php');
$membersOnlineTodayOptions = array(
'sort' => 'login_time',
'reverse_sort' => true,
'period' => 'current_day',
'canview' => 'registered',
);
$context += getMembersOnlineTodayStats($membersOnlineTodayOptions);

Or maybe this code doesn't help anymore?

Anyone?

JimM

You quoted katb's post, but you didn't see my post right after it?

Quote from: JimM on November 22, 2008, 09:23:24 PM
@katb - you are using the wrong file.  Be sure when you use the parser you click the 1.4.0 file for 1.1.7.  If you are seeing those statements you are parsing 1.5.4 which is for 2.0 Beta 4.

You downloaded or are parsing the wrong file!
Jim "JimM" Moore
Former Support Specialist

Cuko

Quote from: JimM on November 25, 2008, 11:30:46 PM
You quoted katb's post, but you didn't see my post right after it?

Quote from: JimM on November 22, 2008, 09:23:24 PM
@katb - you are using the wrong file.  Be sure when you use the parser you click the 1.4.0 file for 1.1.7.  If you are seeing those statements you are parsing 1.5.4 which is for 2.0 Beta 4.

You downloaded or are parsing the wrong file!

To be honest I saw your post after I posted :( Sorry

But a got another problem now...
I did everything as I should and now am getting an error:
Parse error: parse error, unexpected $ in .../Sources/BoardIndex.php on line 610

The 610 line is just the ending of the file (?>)

What went wrong?

Please someone :( My Live forum is now dead :(

JimM

Attach you ./Sources/BoardIndex.php file and I will take a quick look at it.
Jim "JimM" Moore
Former Support Specialist

Cuko


Advertisement: