4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: b.o.fan on August 20, 2006, 04:48:36 PM

Title: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: b.o.fan 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 (http://www.4homepages.de/forum/index.php?topic=10801.0)

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 ;)
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Stoleti on August 20, 2006, 04:52:37 PM
Great Mod !!!

A Question, can we set for 5 (last users) ???  :oops:
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: b.o.fan on August 20, 2006, 04:54:06 PM
Great Mod !!!

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

i dont undersand...
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Stoleti 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) :)
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: b.o.fan on August 20, 2006, 05:05:41 PM
you can change this with
Code: [Select]
$limit = 5;
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Stoleti on August 20, 2006, 05:06:24 PM
you can change this with
Code: [Select]
$limit = 5;

 :D Thanks !!
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Stoleti 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) |
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Loda on August 20, 2006, 07:13:17 PM
fantastic! great work!  :wink:
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: V@no 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)
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Stoleti on August 20, 2006, 07:39:58 PM
Still Showing Guests.....

This would be just for users with account  :|
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: V@no 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...
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: b.o.fan 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 ;)
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: ccsakuweb 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??
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: b.o.fan 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.?
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: ccsakuweb 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
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: JensF on August 21, 2006, 11:22:41 PM
Thanks for this Great Mod...
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: b.o.fan on August 22, 2006, 08:15:25 PM
Thanks for this Great Mod...

Thanx  :oops: :oops:
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: ccsakuweb on August 22, 2006, 08:20:01 PM
 i did all steps..

that are my files (member.php and constant.php) please... i need help.. i would like to have your great mod installed in my site
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Stoleti on August 22, 2006, 10:11:26 PM
we can also show with userpic ??  :P
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: b.o.fan on August 23, 2006, 06:57:55 AM
i did all steps..

that are my files (member.php and constant.php) please... i need help.. i would like to have your great mod installed in my site

i will look what i can do.
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: b.o.fan on August 23, 2006, 06:58:19 AM
we can also show with userpic ??  :P

yes. i will look, how i can do this. then i post it ;)
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: ccsakuweb on August 23, 2006, 03:26:54 PM
i did all steps..

that are my files (member.php and constant.php) please... i need help.. i would like to have your great mod installed in my site

i will look what i can do.

thank you very much  :D
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: ccsakuweb on August 23, 2006, 06:08:35 PM
hi! i tried to install this mod in another gallery without any modification, only phpbb integer 4images.. and this mod doesn´t work too . does this mod work in 1.7.3 version?
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: b.o.fan on August 23, 2006, 07:25:19 PM
hi! i tried to install this mod in another gallery without any modification, only phpbb integer 4images.. and this mod doesn´t work too . does this mod work in 1.7.3 version?

i work with 1.73
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Stoleti on August 24, 2006, 07:21:48 PM
i've this code:

Code: [Select]
$userpic_img = ($config['userpic'] && @file_exists(ROOT_PATH."data/userpic/".$row['userpic']) && $user_info['user_level'] >= USER) ? "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['user_id']."&user_name=".$row['user_name'])."\"><img src=\"".ROOT_PATH."data/userpic/".$row['userpic']."\" width=\"".$config['userpic_width']."\" height=\"".$config['userpic_height']."\" border=\"0\"></a>" : $lang['no_random_userpic'];
how make show userpics with username as " alt="USERNAME" " ???
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: ccsakuweb on August 28, 2006, 11:30:05 AM
yes! it would be great!!

I would like that the guest people could see the last users.. is it possible ?
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: UFOSWORLD on June 27, 2007, 05:58:27 PM
WOW i am searching such a long time for that mod... 

NOW i installed it... @ 1.7.2    Great!!! Works Perfect  ....  i will post here, if i got any errors...

Today is a great day !!!! YEEEEEEAAAAAAAHHHHHHH!!!
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: UFOSWORLD on December 16, 2007, 08:00:22 PM
Question:

How can i add the gender symbol to each visitor... 

user Gender is   user_sex in my 4homepages
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Daniel on January 28, 2008, 07:29:54 PM
So hier nun das Ergebnis meines Hardcore-Test:
Limit 25

Bei ca. 84000 Einträgen war Schluss
Die Datenbank hat dann nur noch sporadisch "neue" Last User on Profil angezeigt.
Abhilfe kann wirklich erst nachdem der lastuser_table geleert war, dann wieden wieder alle Last User on Profil im Profil eingetragen.

------
I test it. But near 84000 inserts in lastuser_table the Last User on Profil Mod ends.
No more inserts in the table, just someone perhaps.
in the moment that i delete the inserts from the lastuser_table the system runs!

kind regards
Daniel
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: thunderstrike on January 28, 2008, 07:57:08 PM
Quote
I test it. But near 84000 inserts in lastuser_table the Last User on Profil Mod ends.

Question - after long time for have 84000 inserts in SQL table ?
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Daniel on January 29, 2008, 05:21:54 AM
The Limit for Last User in Profil is 25.
After six Weeks i have 84000 inserts in the lastuser table. (about 84t)
And then the MOD works just perhaps. Sometimes it work and sometimes it dont work.
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: thunderstrike on January 29, 2008, 02:19:02 PM
The Limit for Last User in Profil is 25.
After six Weeks i have 84000 inserts in the lastuser table. (about 84t)
And then the MOD works just perhaps. Sometimes it work and sometimes it dont work.

Ok, I check code. I see why.

1 - MOD is no check for same user visit self profile (is count too).
2 - MOD is no check for different user visit target profile after 1 time (is count too).
3 - MOD is inject for all visit.
4 - MOD is no remove data after days (like postcards) - (is count too).

Is why, after 6 weeks, you have 84000 inserts ( 8O ) and good thing for host support hi DB permission ...

I say for no one use this MOD if small DB permission of host ...
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Daniel on July 11, 2008, 07:38:21 PM
Next Stop:
Datasets: 7897 insgesamt
Highest lastuser_id:32767 (colum one ind lastuser table)
No mohr Data write in Database


    Feld     Typ    Attribute    Null    Standard    Extra    Aktion
    lastuser_id     smallint(5)         Nein          auto_increment     Ändern    Löschen    Primärschlüssel    Index    Unique    Volltext
    userprofil_id     smallint(10)         Nein     0          Ändern    Löschen    Primärschlüssel    Index    Unique    Volltext
    user_on_id     smallint(10)         Nein     0          Ändern    Löschen    Primärschlüssel    Index    Unique    Volltext
    last_date     int(15)         Nein     0          Ändern    Löschen    Primärschlüssel    Index    Unique    Volltext

PRIMARY      PRIMARY      7897       Bearbeiten       Löschen       lastuser_id
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: bergblume on November 12, 2008, 09:21:23 AM
i've this code:

Code: [Select]
$userpic_img = ($config['userpic'] && @file_exists(ROOT_PATH."data/userpic/".$row['userpic']) && $user_info['user_level'] >= USER) ? "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['user_id']."&user_name=".$row['user_name'])."\"><img src=\"".ROOT_PATH."data/userpic/".$row['userpic']."\" width=\"".$config['userpic_width']."\" height=\"".$config['userpic_height']."\" border=\"0\"></a>" : $lang['no_random_userpic'];
how make show userpics with username as " alt="USERNAME" " ???

is there already a solution how to make this possible? I mean not showing username with text in member profile but also with a user pic?

Looking forward to your suggestions.

Greetz,
bergblume
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Daniel on May 07, 2009, 08:05:38 PM
Next Stop:
Datasets: 9481 insgesamt
Highest lastuser_id:32767 (colum one ind lastuser table)
No mohr Data write in Database
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Nicky on May 07, 2009, 09:28:20 PM
Daniel,

defination of columns are in your case wrong:

you should ALTER colums with smallint to int

BACKUP YOUR DATABASE FIRST!

mysql query for phpmyadmin:
Code: [Select]
ALTER TABLE `4images_lastuser` CHANGE `lastuser_id` `lastuser_id` INT( 10 ) NOT NULL AUTO_INCREMENT
V@no (http://www.4homepages.de/forum/index.php?action=profile;u=596) mentioned that here (http://www.4homepages.de/forum/index.php?topic=7193.0)
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: Daniel on May 07, 2009, 09:33:23 PM
OK

lastuser_id table changed to "int"

I make a new test now.

thanks in advance Nicky
Daniel
Title: Re: [MOD] Last User on Profile / Letzter User auf dem Profil
Post by: luener on October 07, 2009, 11:12:09 AM
...works it with 1.7.7..???

the variables {lang_last_user} and {last_user} gives no output on member_profile.html.

thanks for answer...!
ralf