Advertise Here

Author Topic: Modifications  (Read 1378 times)

0 Members and 1 Guest are viewing this topic.

Offline littlebouncers

  • SMF For Free Member
  • *
  • Posts: 80
    • View Profile
    • Independant Castle Hirers

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Modifications
« on: February 22, 2007, 12:36:07 pm »
I have found this mod, for putting in what user were online today, but im unsure if i can use and how i do use if i can, can any one tell me what i need to remove/add from/to this code, and where i am meant to put to get it to work.

- <modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
  <id>Michael.PedersenAkaCarceri:UsersOnlineTodayMod</id>
  <version>1.4.0</version>
- <file name="$sourcedir/BoardIndex.php" error="fatal">
- <operation error="fatal">
- <search position="before" regexp="false" whitespace="exact">
- <![CDATA[    $context['num_users_online'] = count($context['users_online']) + $context['num_users_hidden'];

  ]]>
  </search>
- <add>
- <![CDATA[    // Load the users online today.
   $date = @getdate(forum_time(false));
   $midnight = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']) - ($modSettings['time_offset'] * 3600);

   $s = strpos($user_info['time_format'], '%S') === false ? '' : ':%S';
   if (strpos($user_info['time_format'], '%H') === false && strpos($user_info['time_format'], '%T') === false)
      $time_fmt = '%I:%M' . $s . ' %p';
   else
      $time_fmt = '%H:%M' . $s;

   $result = db_query("
      SELECT
         mem.ID_MEMBER, mem.lastLogin, mem.realName, mem.memberName, mem.showOnline,
         mg.onlineColor, mg.ID_GROUP, mg.groupName
      FROM {$db_prefix}members AS mem
         LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.lastLogin >= $midnight", __FILE__, __LINE__);

   $context['num_hidden_users_online_today'] = 0;
   $context['users_online_today'] = array();
   $context['list_users_online_today'] = array();

   while ($row = mysql_fetch_assoc($result))
   {
      if (empty($row['showOnline']))
      {
         $context['num_hidden_users_online_today'] = $context['num_hidden_users_online_today'] + 1;
         if (!$user_info['is_admin']) continue;
      }

      $userday = strftime('%d', forum_time(true));
      $loginday = strftime('%d', forum_time(true, $row['lastLogin']));
      $yesterday = $userday == $loginday ? '' : $txt['uot_yesterday'];
   
      $lastLogin = $yesterday . strftime($time_fmt, forum_time(true, $row['lastLogin']));
      $title = ' title="' . $lastLogin . '"';

      // Some basic color coding...
      if (!empty($row['onlineColor']))
         $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . ' style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
      else
         $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . '>' . $row['realName'] . '</a>';

      $is_buddy = in_array($row['ID_MEMBER'], $user_info['buddies']);
      if ($is_buddy)
      {
         $link = '<b>' . $link . '</b>';
      }

      $context['users_online_today'][$row['lastLogin'] . $row['memberName']] = array(
         'id' => $row['ID_MEMBER'],
         'username' => $row['memberName'],
         'name' => $row['realName'],
         'group' => $row['ID_GROUP'],
         'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
         'link' => $link,
         'is_buddy' => $is_buddy,
         'hidden' => empty($row['showOnline']),
      );

      $context['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = empty($row['showOnline']) ? '<i>' . $link . '</i>' : $link;
   }
   mysql_free_result($result);

   krsort($context['users_online_today']);
   krsort($context['list_users_online_today']);

   $context['num_users_online_today'] = count($context['users_online_today']);
   if (!$user_info['is_admin'])
   {
      $context['num_users_online_today'] = $context['num_users_online_today'] + $context['num_hidden_users_online_today'];
   }
  ]]>
  </add>
  </operation>
  </file>
- <file name="$sourcedir/Stats.php" error="fatal">
- <operation error="fatal">
- <search position="before" regexp="false" whitespace="exact">
- <![CDATA[    $context['online_today'] = (int) $context['online_today'];

  ]]>
  </search>
- <add>
- <![CDATA[    // Total members online today
   $date = @getdate(forum_time(false));
   $midnight = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']) - ($modSettings['time_offset'] * 3600);
   $result = db_query("
      SELECT
         COUNT(*)
      FROM {$db_prefix}members
         WHERE lastLogin >= $midnight", __FILE__, __LINE__);
   list ($context['total_users_online_today']) = mysql_fetch_row($result);
  ]]>
  </add>
  </operation>
  </file>
- <file name="$themedir/BoardIndex.template.php" error="fatal">
- <operation error="fatal">
- <search position="before" regexp="false" whitespace="exact">
- <![CDATA[                      ', $txt['most_online_ever'], ': ', $modSettings['mostOnline'], ' (' , timeformat($modSettings['mostDate']), ')
                  </span>
               </td>
            </tr>';

  ]]>
  </search>
- <add>
- <![CDATA[    // Users online today

   echo '
   <tr>
      <td class="titlebg" colspan="2">', $txt['uot_users_online_today'], '</td>
   </tr><tr>
      <td class="windowbg" width="20" valign="middle" align="center">
         <img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt['uot_users_online_today'], '" border="0" />
      </td>
      <td class="windowbg2" width="100%">';

   echo '
         <div class="smalltext">';

  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>' : '', '
         </div>
      </td>
   </tr>';
  ]]>
  </add>
  </operation>
  </file>
- <file name="$themedir/Stats.template.php" error="fatal">
- <operation error="fatal">
- <search position="replace" regexp="false" whitespace="exact">
- <![CDATA[                      <td nowrap="nowrap">', $txt['users_online_today'], ':</td>
                     <td align="right">', $context['online_today'], '</td>';
  ]]>
  </search>
- <add>
- <![CDATA[                      <td nowrap="nowrap">', $txt['users_online_today'], ':</td>
                     <td align="right">', $context['online_today'], '</td>
                  </tr><tr>
                     <td nowrap="nowrap">', $txt['uot_users_online_today'], ':</td>
                     <td align="right">', $context['total_users_online_today'], '</td>';
  ]]>
  </add>
  </operation>
  </file>
- <file name="$languagedir/Modifications.english.php" error="fatal">
- <operation error="fatal">
  <search position="end" regexp="false" whitespace="exact" />
- <add>
- <![CDATA[ $txt['uot_users_online_today']='Users Logged In Today';
$txt['uot_yesterday']='Yesterday at ';
$txt['uot_total']='Total';
$txt['uot_visible']='Visible';
$txt['uot_hidden']='Hidden';
  ]]>
  </add>
  </operation>
  </file>
- <file name="$languagedir/Stats.english.php" error="fatal">
- <operation error="fatal">
- <search position="replace" regexp="false" whitespace="exact">
- <![CDATA[ $txt['users_online_today'] = 'Online Today';
$txt['num_hits'] = 'Total page views';
$txt['average_hits'] = 'Average page views per day';

  ]]>
  </search>
- <add>
- <![CDATA[ $txt['users_online_today'] = 'Most Online Today';
$txt['num_hits'] = 'Total page views';
$txt['average_hits'] = 'Average page views per day';
  ]]>
  </add>
  </operation>
  </file>
  </modification>

Hope makes sense to someone

cheers
Richard

Offline Crasy

  • Global Moderator
  • *
  • Posts: 3960
  • Semi-Retired ;)
    • View Profile

  • Total Badges: 29
    Badges: (View All)
    Poll Starter Poll Voter Seventh year Anniversary Arcade Highscore Windows User
Re: Modifications
« Reply #1 on: February 22, 2007, 02:07:18 pm »
Is that PHP?

I don't think it will work. Most mods won't work in the headers/footers.
Did my answer help you? Want to help out hosting costs?


Every donation counts.

Offline SMF For Free

  • Administrator
  • *
  • Posts: 7306
    • View Profile
    • SMF For Free

  • Total Badges: 38
    Badges: (View All)
    Quick Poster Tenth year Anniversary Spammer 25 Posts in one day Nineth year Anniversary Eighth year Anniversary
Re: Modifications
« Reply #2 on: February 22, 2007, 03:12:07 pm »
Mods will not with SMF For Free don't even try to look for them.
SMF For Free-Free Simple Machines Forum hosting.
Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline littlebouncers

  • SMF For Free Member
  • *
  • Posts: 80
    • View Profile
    • Independant Castle Hirers

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Modifications
« Reply #3 on: February 23, 2007, 03:21:52 pm »
i came across it when looking at some themes and was just wondering if they worked or not, no matter

Richard

 

Related Topics

  Subject / Started by Replies Last post
4 Replies
1247 Views
Last post January 05, 2008, 05:47:14 pm
by clown
6 Replies
2587 Views
Last post May 23, 2008, 06:49:59 am
by josh555
1 Replies
874 Views
Last post August 17, 2008, 06:33:20 pm
by simply sibyl
3 Replies
2711 Views
Last post August 23, 2009, 04:57:46 pm
by Jntg4