How to show the user name, instead of IP address, in "last viewed" How to show the user name, instead of IP address, in "last viewed"
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

How to show the user name, instead of IP address, in "last viewed"

Started by GlenVision, January 28, 2008, 08:50:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GlenVision

The "last viewed" feature shows IP addresses when viewed as an admin. Is there a way to modify Coppermine to allow showing the person's user name instead of their IP address?

Having the ability to show both might be nice as well. Also, I only want this information displayed when browsing as an admin. I don't want the general public knowing who has looked at what.

I looked for a mod, plugin, or hack that would do this, but I can't find anything. I might have a go at it myself, if someone wanted to point me in the right direction. (I'm a total beginner at php.)

thanks,
Glen

Nibbler


GlenVision


Veronica

It's easy

find in /include/functions.inc.php
cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET hits=hits+1, lasthit_ip='$raw_ip', mtime=CURRENT_TIMESTAMP WHERE pid='$pid'");

replace with
cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET hits=hits+1, lasthit_ip='" . USER_NAME . "', mtime=CURRENT_TIMESTAMP WHERE pid='$pid'");

probably you should remove slashes too in same functions.inc.php

find
$caption .="<br/>".row['lasthit_ip'];

replace with
$caption .="<br/>".stripslashes ($row['lasthit_ip']);

and also replace the heading IP to username in your theme

GlenVision