Author Topic: .  (Read 202149 times)

0 Members and 1 Guest are viewing this topic.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #75 on: January 17, 2006, 07:03:18 PM »
Since you're using this MOD from your home.html file, please post the codings you added from your index.php file and I will give further instructions.

Offline Birne

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #76 on: January 17, 2006, 10:30:43 PM »
Hi !
i don´t added any changes to my index.php.
btw: i´m using version 1.7.1 !

As described in the instruction i added the following code in my includes/page_header.php

Code: [Select]
//-----------------------------------------------------
//--- Last active User --------------------------------
//-----------------------------------------------------
$sql = "SELECT user_name, user_id, user_lastaction FROM ".USERS_TABLE."
                WHERE user_level >= '".GUEST."'
                   ORDER BY user_lastaction DESC
                LIMIT 5";
   $result = $site_db->query($sql);

   while ($row = $site_db->fetch_array($result)) {
   $last_action_user_list .= "<a href =\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\"><b>".$row['user_name']."</b></a>&nbsp;&nbsp;<span class=\"smalltext\">".format_date($config['date_format']." ".$config['time_format'], $row['user_lastaction'])."</span>&nbsp;&nbsp;&nbsp;";
   }

$site_template->register_vars(array(
"lang_user_last_action" => $lang['lang_user_last_action'],   
"user_last_action_list" => $last_action_user_list
));
$site_template->register_vars("user_last_action_box", $site_template->parse_template("user_last_action_box"));

 unset($user_last_action_box);
 unset($last_action_user_list);

regards birne

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #77 on: January 17, 2006, 10:46:10 PM »
Quote

i don´t added any changes to my index.php.


Right. My bad.  :oops:

Now, in your includes/page_header.php file,

find :

Quote

$site_template->register_vars(array(
"lang_user_last_action" => $lang['lang_user_last_action'],   
"user_last_action_list" => $last_action_user_list
));
$site_template->register_vars("user_last_action_box", $site_template->parse_template("user_last_action_box"));

unset($user_last_action_box);
unset($last_action_user_list);


replace with :

Code: [Select]

if ($user_info['user_level'] > GUEST) {

$site_template->register_vars(array(
"lang_user_last_action" => $lang['lang_user_last_action'],   
"user_last_action_list" => $last_action_user_list
));
$site_template->register_vars("user_last_action_box", $site_template->parse_template("user_last_action_box"));

unset($user_last_action_box);
unset($last_action_user_list);

}


This should restrict GUEST level to see the window from now on. In the mean time, in your home.html file, you should be able to use :

Quote

{if user_loggedin}your HTML arguments here{endif user_loggedin}


;)

Offline Birne

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #78 on: January 17, 2006, 10:53:50 PM »
cool, that works perfekty.
thanks TheOracle !

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #79 on: January 17, 2006, 10:54:16 PM »
No problem - enjoy ! 8)

Offline Zyga

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #80 on: January 18, 2006, 12:30:31 AM »
Little help needed
Here is my code fragment from page_header.php file

$last_action_user_list .= "<TR class=\"row_bg_number\"><TD><img src=\"".TEMPLATE_PATH."/avatars/user_avatar_current\" width=\"30\" height=\"40\"/></TD><TD><a href =\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\"><b>".$row['user_name']."</b></a><br /><span class=\"smalltext\">".$last_user_date."</span><br /></TD></TR> ";


i dont know what should i place in field marked with red
if some one could help me it would be great

edit: sorry i must remove >code< tag becouse >red< tag wont work

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #81 on: January 18, 2006, 03:05:03 PM »
Quote

$last_action_user_list .= "<TR class=\"row_bg_number\"><TD><img src=\"".TEMPLATE_PATH."/avatars/user_avatar_current\" width=\"30\" height=\"40\"/></TD><TD><a href =\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\"><b>".$row['user_name']."</b></a><br /><span class=\"smalltext\">".$last_user_date."</span><br /></TD></TR> ";


change to :

Quote

$last_action_user_list .= "<TR class=\"row1(or row2 - your choice)\"><TD><img src=\"".TEMPLATE_PATH."/avatars/".$row['user_avatar']."\" name=\"icons\" border=\"0\" alt=\"\" width=\"30\" height=\"40\"/></TD><TD><a href =\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\"><b>".$row['user_name']."</b></a><br /><span class=\"smalltext\">".$last_user_date."</span><br /></TD></TR> ";


Then, from your SQL SELECT statement line, make sure you add the user_avatar row as well. ;)

Quote

edit: sorry i must remove >code< tag becouse >red< tag wont work


I know what you mean, this has been discussed before. :roll:

Use quote rather than code to use colors inside. ;)

Offline Zyga

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #82 on: January 19, 2006, 05:27:44 PM »
Avatar wont work before becouse i forgot add user_avatar  to SQL SELECT statement line like U say  :oops: (THX)

With TR class....
I found something  in Last comments v1
http://www.4homepages.de/forum/index.php?topic=7848.0

now my code from page_header.php is:

Code: [Select]
$sql = "SELECT user_name, user_id, user_lastaction, user_avatar FROM ".USERS_TABLE."
                WHERE user_level >= '".GUEST."'
                   ORDER BY user_lastaction DESC
                LIMIT 5";
   $result = $site_db->query($sql);
                $site_template->register_vars(array(
          ));
     
$bgcounter = 1;

while ($row = $site_db->fetch_array($result)) {
   if(date("dmy", $row['user_lastaction']) == date("dmy")) {
  $last_user_date = $lang['lang_user_last_today']."  ".format_date($config['time_format'], $row['user_lastaction']);
  }else {
      $last_user_date = format_date($config['date_format']." ".$config['time_format'], $row['user_lastaction']);
  }
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $last_action_user_list .= "<TR class=\"row".$row_bg_number."\"><TD><img src=\"".TEMPLATE_PATH."/avatars/".((!empty($row['user_avatar'])) ? $row['user_avatar'] : "blank.gif")." \" name=\"icons\" border=\"0\" alt=\"\"  width=\"30\" height=\"40\"/></TD><TD><a href =\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\"><b>".$row['user_name']."</b></a><br /><span class=\"smalltext\">".$last_user_date."</span><br /></TD></TR> ";
}

and everything works  :)

edit ->  Zyga - > update
little correction  - previous version was with bug

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: [Mod] Letze aktive User / Last active users
« Reply #83 on: February 05, 2006, 07:26:25 AM »
Hey,
i installed the mod a few weeks ago,
but have to change the 4images code to integrate a board.

The Problem is here,
that the code, given on the first site, is not really compatible with 4images,
if you change standard values in session.php & constants.php.

So it would be nice, if a mod could change the code on the frist site,
to make it really 4images compatible.
although i know this would related to only a few members.  8)

This Code:
Code: [Select]
//-----------------------------------------------------
//--- Last active User --------------------------------
//-----------------------------------------------------
$last_action_user_list = "";
$sql = "SELECT user_name, user_id, user_lastaction FROM ".USERS_TABLE."
                WHERE user_level >= '".GUEST."'
                   ORDER BY user_lastaction DESC
                LIMIT 5";
   $result = $site_db->query($sql);

   while ($row = $site_db->fetch_array($result)) {
   $last_action_user_list .= "<a href =\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\"><b>".$row['user_name']."</b></a><br ><span class=\"smalltext\">".format_date($config['date_format']." ".$config['time_format'], $row['user_lastaction'])."</span><br >";
   }

$user_last_action_box = $site_template->parse_template("user_last_action_box");
$site_template->register_vars(array(
 "user_last_action_box" => $user_last_action_box,
 "lang_user_last_action" => $lang['lang_user_last_action'],   
 "user_last_action_list" => $last_action_user_list
));
 unset($user_last_action_box);
 unset($last_action_user_list);

should be like this:
Code: [Select]
//-----------------------------------------------------
//--- Last active User --------------------------------
//-----------------------------------------------------
$last_action_user_list = "";
$sql = "SELECT ".get_user_table_field("", "user_name").", ".get_user_table_field("", "user_id").", ".get_user_table_field("", "user_lastaction")." FROM ".USERS_TABLE."
              WHERE ".get_user_table_field("", "user_level")."l >= '".GUEST."'
              ORDER BY ".get_user_table_field("", "user_lastaction")." DESC
              LIMIT 5";
   $result = $site_db->query($sql);

   while ($row = $site_db->fetch_array($result)) {
      $last_action_user_list .= "<a href =\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row[$user_table_fields['user_id']])."\"><b>".$row[$user_table_fields['user_name']]."</b></a> (<span class=\"smalltext\">".format_date($config['date_format']." ".$config['time_format'], $row[$user_table_fields['user_lastaction']])."</span>), ";
   }

$user_last_action_box = $site_template->parse_template("user_last_action_box");
$site_template->register_vars(array(
 "user_last_action_box" => $user_last_action_box,
 "lang_user_last_action" => $lang['lang_user_last_action'],   
 "user_last_action_list" => $last_action_user_list
));
 unset($user_last_action_box);
 unset($last_action_user_list);

as you see i changed only the code to get the right get_user_table_fields, which declared in the config files,
if you dont use the standard config.

thanks
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #84 on: February 06, 2006, 06:17:33 AM »
@icecream:

Actually, your codings above are nicely translated into 4images codings. Althought, two comments to state :

Quote

$sql = "SELECT ".get_user_table_field("", "user_name").", ".get_user_table_field("", "user_id").", ".get_user_table_field("", "user_lastaction")." FROM ".USERS_TABLE."
              WHERE ".get_user_table_field("", "user_level")."l >= '".GUEST."'
              ORDER BY ".get_user_table_field("", "user_lastaction")." DESC
              LIMIT 5";
   $result = $site_db->query($sql);


paranoidly known like this :

Quote

$sql = "

SELECT ".get_user_table_field("", "user_name").", ".get_user_table_field("", "user_id").", ".get_user_table_field("", "user_lastaction")."
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_level")."l >= '".GUEST."'
ORDER BY ".get_user_table_field("", "user_lastaction")." DESC
LIMIT 5

";

$result = $site_db->query($sql);


As for this line :

Quote

$last_action_user_list .= "<a href =\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row[$user_table_fields['user_id']])."\"><b>".$row[$user_table_fields['user_name']]."</b></a> (<span class=\"smalltext\">".format_date($config['date_format']." ".$config['time_format'], $row[$user_table_fields['user_lastaction']])."</span>), ";


there's no need to add the $user_table_fields in this case. ;)

Meaning, it should simply go like this :

Code: [Select]

$last_action_user_list .= "<a href =\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['user_id'])."\"><b>".$row['user_name']."</b></a> (<span class=\"smalltext\">".format_date($config['date_format']." ".$config['time_format'], $row['user_lastaction'])."</span>), ";


;)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Letze aktive User / Last active users
« Reply #85 on: February 06, 2006, 06:56:39 AM »
there's no need to add the $user_table_fields in this case. ;)
You are wrong.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: [Mod] Letze aktive User / Last active users
« Reply #86 on: February 06, 2006, 09:13:03 PM »
@Oracle:

you mean my formating of the code?
In my code it is like this,
is just because i modified things at that time  and thats
why this is formated like this as i posted here.

And like vano already said,
the $user_table_fields are needed.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #87 on: February 06, 2006, 09:16:22 PM »
@icecream:

I didn't said it wasn't working or anything, I just stated it was working the first time even without the $user_table_fields since the first date release. ;)

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: [Mod] Letze aktive User / Last active users
« Reply #88 on: February 06, 2006, 10:06:57 PM »
ok, as i said, this works for about 98% of the users.
It affects only, if you modify your settings in constants.php & session.php
for non-standard table names and user variables,
which i need because i intergrated my board to the gallery using the boards usertable.

so with my comment, the mod should work also with these modifications,
and then $usertablefields modification is also needed like the "get_user_table_field" as i posted.
I mean if i post here a corection to make this useful mod 4images compatible,
then i do it corecctly..^^


Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Letze aktive User / Last active users
« Reply #89 on: February 06, 2006, 10:44:22 PM »
Quote

so with my comment, the mod should work also with these modifications,
and then $usertablefields modification is also needed like the "get_user_table_field" as i posted.
I mean if i post here a corection to make this useful mod 4images compatible,
then i do it corecctly..^^


Thanks for the details and, yes, it has been done correctly. ;)