Author Topic: [MOD] Last User on Profile / Letzter User auf dem Profil  (Read 46487 times)

0 Members and 1 Guest are viewing this topic.

b.o.fan

  • Guest
[MOD] Last User on Profile / Letzter User auf dem Profil
« on: August 20, 2006, 04:48:36 PM »
Hello @ all... I have made a littel thing to show the last User on User's Profil.

Here is the Requestion: look here

SAVE YOUR FILES, AND MAKE A BACKUP!

Changed Files:

./member.php
./includes/constants.php
./lang/<your_language>/main.php
./templates/<your_tempalte>/member_profile.html

Make a new database-field.

You can use this Code:

Code: [Select]
CREATE TABLE `4images_lastuser` (
  `lastuser_id` smallint(5) NOT NULL auto_increment,
  `userprofil_id` smallint(10) NOT NULL default '0',
  `user_on_id` smallint(10) NOT NULL default '0',
  `last_date` int(15) NOT NULL default '0',
  PRIMARY KEY  (`lastuser_id`)
) TYPE=MyISAM ;


1.

Open ./includes/constants.php

Find there:
Code: [Select]
define('WORDLIST_TABLE', $table_prefix.'wordlist');
add after

Code: [Select]
define('LASTUSER_TABLE', $table_prefix.'lastuser');
2.
Open ./member.php

2.1.Find there:

Code: [Select]
  if ($user_row = get_user_info($user_id)) {
    $user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;
    if (!empty($user_homepage) && $user_homepage != REPLACE_EMPTY) {
      $user_homepage_button = "<a href=\"".$user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$user_homepage."\" /></a>";
    }
    else {
      $user_homepage_button = REPLACE_EMPTY;
    }
 
add after

Code: [Select]
    if($user_info['user_id'] <> GUEST)
    {
    if($user_info[user_id] <>  $user_row['user_id'])
    {
     $query = "SELECT COUNT(*) FROM ".LASTUSER_TABLE." WHERE userprofil_id = '".$user_row['user_id']."' AND user_on_id = '".$user_info[user_id]."' ";
     $sql = mysql_query($query);
     $on = mysql_result($sql,0);
     if($on == "0")
     {
       $time = time();
       $query = "INSERT INTO ".LASTUSER_TABLE." (userprofil_id, user_on_id, last_date) VALUES ('".$user_row['user_id']."', '".$user_info[user_id]."', '".$time."') ";
       $sql = mysql_query($query);
     }
     if($on == "1")
     {
       $new_time = time();
       $query = "UPDATE ".LASTUSER_TABLE." SET last_date = '".$new_time."' WHERE userprofil_id = '".$user_row['user_id']."' AND user_on_id = '".$user_info[user_id]."' ";
       $sql = mysql_query($query);
     }
    }
    $limit = 5;  // IF YOU WANT SHOW MORE THEN 5 CHANGE IT ;)
    $query = "SELECT lastuser_id, userprofil_id, user_on_id, last_date, u.user_id, user_name FROM (".LASTUSER_TABLE." i)
              LEFT JOIN ".USERS_TABLE." u ON (u.user_id) = i.user_on_id
              WHERE userprofil_id = ".$user_row['user_id']." ORDER BY i.last_date DESC LIMIT 0 , ".$limit."";
    $sql = mysql_query($query);

    while($ds = mysql_fetch_object($sql))
    {
      $on_time = date("d.m.Y H:i", $ds->last_date);
      $last_user .= "<a href='member.php?action=showprofile&user_id=".$ds->user_id."'>".$ds->user_name."</a> <small>(".$on_time.")</small> | ";
    }

    $query = "SELECT COUNT(*) FROM ".LASTUSER_TABLE." WHERE userprofil_id = '".$user_row['user_id']."' ";
    $sql = mysql_query($query);
    $on = mysql_result($sql,0);

    if($on > $limit)
    {
      $query = "SELECT * FROM ".LASTUSER_TABLE." WHERE userprofil_id = '".$user_row['user_id']."' ORDER BY last_date DESC LIMIT ".$limit.", ".$limit." ";
      $sql = mysql_query($query);
      $ds = mysql_fetch_object($sql);

      $query = "DELETE FROM ".LASTUSER_TABLE." WHERE userprofil_id = '".$user_row['user_id']."' AND last_date <= ".$ds->last_date." ";
      $sql = mysql_query($query);
    }
    }
   
2.2.Find

Code: [Select]
"user_icq" => $user_icq,
add before

Code: [Select]
"last_user" => $last_user,
      "lang_last_user" => $lang['last_user'],


3.Open ./lang/<your_language>/main.php

add before

Code: [Select]
?>
this here:
/// GERMAN ///
Code: [Select]
//-------------------------------------------
//----Last User on Profil -------------------
//-------------------------------------------
$lang['last_user'] = "Letze User: ";

/// ENGLISH ///
Code: [Select]
//-------------------------------------------
//----Last User on Profil -------------------
//-------------------------------------------
$lang['last_user'] = "Last User: ";

Open ./template/<your_template>/member_profile.html

add where you want:

Code: [Select]
<b>{lang_last_user}</b> {last_user}
pls feedback ;)

Have Fun ;)
« Last Edit: August 21, 2006, 06:45:48 AM by b.o.fan »

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #1 on: August 20, 2006, 04:52:37 PM »
Great Mod !!!

A Question, can we set for 5 (last users) ???  :oops:

b.o.fan

  • Guest
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #2 on: August 20, 2006, 04:54:06 PM »
Great Mod !!!

A Question, can we set for 5 (last users) ???  :oops:

i dont undersand...

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #3 on: August 20, 2006, 04:55:16 PM »
Great Mod !!!

A Question, can we set for 5 (last users) ???  :oops:

i dont undersand...

I mean the last 5 users at profile (visitors) :)

b.o.fan

  • Guest
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #4 on: August 20, 2006, 05:05:41 PM »
you can change this with
Code: [Select]
$limit = 5;

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #5 on: August 20, 2006, 05:06:24 PM »
you can change this with
Code: [Select]
$limit = 5;

 :D Thanks !!

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #6 on: August 20, 2006, 06:35:51 PM »
how make it track only reg. users and not Guest's !?

Guest (20.08.2006 14:28) |

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #7 on: August 20, 2006, 07:13:17 PM »
fantastic! great work!  :wink:

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] Last User on Profile / Letzter User auf dem Profil
« Reply #8 on: August 20, 2006, 07:22:44 PM »
@b.o.fan:
Nice mod, but please make it use 4images build-in database class.($site_db)

also, debuging leftovers?
Code: [Select]
       echo $time;
:)
@Stoleti:
Looks like a bug. line
Code: [Select]
    if($user_id <> GUEST)Should be
Code: [Select]
    if($user_info['user_id'] <> GUEST)
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 Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #9 on: August 20, 2006, 07:39:58 PM »
Still Showing Guests.....

This would be just for users with account  :|

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] Last User on Profile / Letzter User auf dem Profil
« Reply #10 on: August 20, 2006, 07:44:53 PM »
well, yes, it will show guests, cause they already were added into the database...but in the future when the limit reached and old entries deleted, guests should not be logged again...
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)

b.o.fan

  • Guest
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #11 on: August 20, 2006, 10:35:06 PM »
@b.o.fan:
Nice mod, but please make it use 4images build-in database class.($site_db)

also, debuging leftovers?
Code: [Select]
       echo $time;
:)
@Stoleti:
Looks like a bug. line
Code: [Select]
    if($user_id <> GUEST)Should be
Code: [Select]
    if($user_info['user_id'] <> GUEST)

oops :)

the 4images class? hmm... how i can use this? i'm not perfect ;)

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #12 on: August 21, 2006, 12:32:24 AM »
I donīt see the names from the last users...

I see <b>{lang_last_user}</b> but I donīt see {last_user} in the plofile...

My site: http://www.paxykochan.net/myart/member.php?action=showprofile&user_id=2

please could you help me??
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

b.o.fan

  • Guest
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #13 on: August 21, 2006, 06:45:03 AM »
I donīt see the names from the last users...

I see <b>{lang_last_user}</b> but I donīt see {last_user} in the plofile...

My site: http://www.paxykochan.net/myart/member.php?action=showprofile&user_id=2

please could you help me??

dit you step 2.2.?

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [MOD] Last User on Profile / Letzter User auf dem Profil
« Reply #14 on: August 21, 2006, 09:54:24 AM »
yes... i did all steps..

that are my files (member.php and constant.php):

constants.php
Code: [Select]
PLEASE ATTACH THE FILES.
DO NOT SHOW CONTENT OF THE FILES IN THE REPLYS, IT ONLY MAKES THIS FORUM SLOWER
« Last Edit: August 21, 2006, 10:06:17 AM by V@no »
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more