MOD download & history

This mod will register when the user last logged in, allong with the info about how meny users have visited the board

Moderator: Moderators

Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Comments

Postby Guest on Mon 22. Apr, 2002 19:20

Thanks for the great mod work. I have a two comments.
  1. In the comments sections adding a note of where to find the latest version would be handy for when distributed from other sources than here. (e.g. with phpbb 2.0 Gold)
  2. In "Part 2.txt", updating phpBB2/memberlist.php, the value for 'LAST_LOGON' you do a check to see if the user is logged on and if so use $userdate['user_timezone'] if not the board timezone. If you look in phpBB2/includes/functions.php under init_userprefs() you see that $board_config['board_timezone'] is set to the user's timezone. Could save you a ternary op.
Guest
 

Re: Comments

Postby Niels on Mon 22. Apr, 2002 19:33

Anonymous wrote:Thanks for the great mod work. I have a two comments.
  1. In the comments sections adding a note of where to find the latest version would be handy for when distributed from other sources than here. (e.g. with phpbb 2.0 Gold)


This site is not ment as an alternativ to phpbb.com, only a temporary site, while phpBB.com gets finished, after that, my mods will be posted there - so I gues that answers this
  • In "Part 2.txt", updating phpBB2/memberlist.php, the value for 'LAST_LOGON' you do a check to see if the user is logged on and if so use $userdate['user_timezone'] if not the board timezone. If you look in phpBB2/includes/functions.php under init_userprefs() you see that $board_config['board_timezone'] is set to the user's timezone. Could save you a ternary op.


  • Thanks I did know that, but have forgot to correct this, there is no point wasting CPU power
    User avatar
    Niels
    Poster
    Poster
     
    Posts: 4390
    Joined: Sat 27. Jul, 2002 15:46

    Postby Niels on Mon 22. Apr, 2002 19:41

    PART 2 is updated to ver 1.0.10, minor correction as posted above,

    here are how to upgrade for users already done the mod
    Code: Select all
    in file memberlist.php
    [FIND]:
    'LAST_LOGON' => ($userdata['user_level'] == ADMIN || (!$board_config['hidde_last_logon'] && $row['user_allow_viewonline'])) ? (($row['user_lastlogon'])? create_date($userdata['user_dateformat'], $row['user_lastlogon'], (($userdata['session_logged_in'])? $userdata['user_timezone']:$board_config['board_timezone'])):$lang['Never_last_logon']):$lang['Hidde_last_logon'],

    [REPLACE WITH]:
    'LAST_LOGON' => ($userdata['user_level'] == ADMIN || (!$board_config['hidde_last_logon'] && $row['user_allow_viewonline'])) ? (($row['user_lastlogon'])? create_date($userdata['user_dateformat'], $row['user_lastlogon'], $board_config['board_timezone']):$lang['Never_last_logon']):$lang['Hidde_last_logon'],
    User avatar
    Niels
    Poster
    Poster
     
    Posts: 4390
    Joined: Sat 27. Jul, 2002 15:46

    Postby Guest on Tue 23. Apr, 2002 15:01

    PART 1 is now updated to ver 1.0.9, minor cosmetic change

    here are how to upgrade
    in file page_header.php
    Code: Select all
    [FIND]:
    "USERS_TODAY_LIST" => $users_today_list . (($userdata[user_level] != ADMIN) ? sprintf( (($users_today_list_hidden > 1) ? $lang['Users_today_list_hidden_more']: $lang['Users_today_list_hidden']) , $users_today_list_hidden) : ''),
    [REPLACE WITH]:
    "USERS_TODAY_LIST" => $users_today_list . (($userdata[user_level] != ADMIN && $users_today_list_hidden) ? sprintf( (($users_today_list_hidden > 1) ? $lang['Users_today_list_hidden_more']: $lang['Users_today_list_hidden']) , $users_today_list_hidden) : ''),
    Guest
     

    Postby Niels on Sat 04. May, 2002 12:23

    I have updated how time zones are handled,
    new version is ver 1.0.10

    here are how to upgrade to ver 1.0.10 (PART 1) for users already done the mod
    in file page_header.php
    Code: Select all
    [FIND]
    $dato=create_date('mdY', time(),$board_config['board_timezone']);
    $timetoday=mktime(0,1,0,$dato[0].$dato[1],$dato[2].$dato[3],$dato[4].$dato[5].$dato[6].$dato[7]);

    [REPLACE WITH]
    $dato=create_date('Hi', time(),$board_config['board_timezone']);
    $timetoday = time() - (3600*($dato[0].$dato[1])) - (60*($dato[2].$dato[3]));
    Last edited by Niels on Mon 06. May, 2002 14:55, edited 1 time in total.
    User avatar
    Niels
    Poster
    Poster
     
    Posts: 4390
    Joined: Sat 27. Jul, 2002 15:46

    Postby Niels on Sun 05. May, 2002 14:19

    The was a minor typo in my previous update instruktion to PART 1

    the [REPLACE] should have been
    Code: Select all
    $dato=create_date('Hi', time(),$board_config['board_timezone']);
    $timetoday = time() - (3600*($dato[0].$dato[1])) - (60*($dato[2].$dato[3]));


    please correct this, if you have done the update, or if you are runing with version 1.0.10

    new version is now 1.0.11
    User avatar
    Niels
    Poster
    Poster
     
    Posts: 4390
    Joined: Sat 27. Jul, 2002 15:46

    Postby Niels on Wed 15. May, 2002 21:11

    I have now updated the how-to, so the information on the index page also tell how menny users within the last hour
    new version is 1.0.13.

    here are how to upgrade

    in file page_header.php
    Code: Select all
    [FIND]
    //show dayly users mod
    $dato=create_date('Hi', time(),$board_config['board_timezone']);
    $timetoday = time() - (3600*($dato[0].$dato[1])) - (60*($dato[2].$dato[3]));
    $sql = 'SELECT user_id,username,user_allow_viewonline,user_level FROM ' . USERS_TABLE . ' WHERE user_lastlogon >= '.$timetoday.' AND user_lastlogon< '.($timetoday+86399).' ORDER BY username';
    if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve user today data", "", __LINE__, __FILE__, $sql);
    while( $todayrow = $db->sql_fetchrow($result))
    {
       $style_color = "";
       if( $todayrow['user_level'] == ADMIN )
       {
          $todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
          $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
       }
       else if( $todayrow['user_level'] == MOD )
       {
          $todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
          $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
       }
       $users_today_list.=($todayrow['user_allow_viewonline']) ? ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'><b>' . $todayrow['username'] . '</b></a>':(($userdata[user_level]==ADMIN)?' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'><i>' . $todayrow['username'] . '</i></a>':'');
       if (!$todayrow['user_allow_viewonline']) $users_today_list_hidden++;
    }
    $users_today=$db->sql_numrows($result);

    [REPLACE WITH]
    //show dayly users mod
    // $dato=create_date('mdY', time(),$board_config['board_timezone']);
    // $timetoday=mktime(0,1,0,$dato[0].$dato[1],$dato[2].$dato[3],$dato[4].$dato[5].$dato[6].$dato[7]);

    $dato=create_date('Hi', time(),$board_config['board_timezone']);
    $timetoday = time() - (3600*($dato[0].$dato[1])) - (60*($dato[2].$dato[3]));
    $time1Hour=time()-3600;

    $sql = 'SELECT user_id,username,user_allow_viewonline,user_level,user_lastlogon FROM ' . USERS_TABLE . ' WHERE user_lastlogon >= '.$timetoday.' AND user_lastlogon< '.($timetoday+86399).' ORDER BY username';
    if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve user today data", "", __LINE__, __FILE__, $sql);

    while( $todayrow = $db->sql_fetchrow($result))
    {
       $style_color = "";
       if( $todayrow['user_level'] == ADMIN )
       {
          $todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
          $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
       }
       else if( $todayrow['user_level'] == MOD )
       {
          $todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
          $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
       }
    if ($todayrow['user_lastlogon']>=$time1Hour)
    {
       $users_lasthour++;
    }
    $users_today_list .= ($users_today_list&& ($todayrow['user_allow_viewonline'] || $userdata[user_level]==ADMIN))? ', ':'';
    $users_today_list.=( $todayrow['user_allow_viewonline'])?' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'><b>' . $todayrow['username'] . '</b></a>':(($userdata[user_level]==ADMIN)?' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'><i>' . $todayrow['username'] . '</i></a>':'');
       if (!$todayrow['user_allow_viewonline']) $users_today_list_hidden++;
    }
    $users_today=$db->sql_numrows($result);

    [FIND]
    'L_USERS_TODAY' =>sprintf($lang['Users_today_explain'],$users_today),

    [ADD AFTER]
    'L_USERS_LASTHOUR' =>($users_lasthour)?sprintf($lang['Users_lasthour_explain'],$users_lasthour):$lang['Users_lasthour_none_explain'],


    in file index_body.php
    Code: Select all
    [FIND]
    <td class="row1" align="left"><span class="gensmall">{L_USERS_TODAY}<br />{USERS_TODAY_LIST}</span></td>   

    [REPLACE WITH]
    <td class="row1" align="left"><span class="gensmall">{L_USERS_TODAY}&nbsp;{L_USERS_LASTHOUR}<br />{USERS_TODAY_LIST}</br></span></td>   


    in file lang_main.php
    Code: Select all
    [FIND]
    $lang['Never_last_logon'] = "Never";

    [ADD AFTER]
    $lang['Users_today_explain'] = "The following %d users have visited the board today.";
    $lang['Users_today_list_hidden']=' and %d hidden user'; //note there is a space as first char
    $lang['Users_today_list_hidden_more']=' and %d hidden users'; //note there is a space as first char
    User avatar
    Niels
    Poster
    Poster
     
    Posts: 4390
    Joined: Sat 27. Jul, 2002 15:46

    Postby ralphlei on Mon 20. May, 2002 18:24

    Niels, I am just wondering whether you have updated the last_visit.zip file or not :D
    ralphlei
    Poster
    Poster
     
    Posts: 83
    Joined: Mon 12. Aug, 2002 22:52

    PreviousNext

    Return to Last visit [2.0.10/EM]

    Who is online

    Users browsing this forum: No registered users and 1 guest

    cron