Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...
Author Message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9456
Location: Arizona

PostPosted: Thu Jan 06, 2005 7:02 pm Reply with quote

I have been wanting to know when is the last time my users have accessed my phpNuke site. I have searched and searched in these Forums and cannot find anything like this. [To be honest, the user management functions within phpNuke leave MUCH to be desired.]

Does anyone know if this is possible? Does someone know of a hack maybe to add to Members List for just Admins?

TIA,
montego
 
View user's profile Send private message Visit poster's website
ecvej
Hangin' Around


Joined: Oct 10, 2004
Posts: 45
Location: Northampton, UK

PostPosted: Fri Jan 07, 2005 1:22 am Reply with quote

I think I'll be able to do this, I'll have a look at it after work tonight (12 hours from this post give or take)
 
View user's profile Send private message
PHrEEkie
Subject Matter Expert


Joined: Feb 23, 2004
Posts: 358

PostPosted: Fri Jan 07, 2005 11:43 am Reply with quote

In your users table, there is a field user_lastvisit. The last visit is stored as a UNIX timestamp, but easily converted to a date by using the date() function to format it. How to call it depends on where you want it to show up. I've always had my own hack for the Forums where the last visit shows right under the Avatar and in the Memberlist. Adding this field to the users table SQL call is quite simple using the Forums filesystem. If you want it to show up in Nuke somewhere, most likely you'll need to write a quick standalone SQL query to pull it.

PHrEEk

_________________
PHP - Breaking your legacy scripts one build at a time. 
View user's profile Send private message
ecvej
PostPosted: Fri Jan 07, 2005 6:27 pm Reply with quote

I did this with chatserves 6.9


Open Member_List folder, edit index.php:
Code:
####Find#### 


$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar

####Replace With####
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar, user_lastvisit

####Find####
$username = $row['username'];

####After Add####
$lastvisit = $row['user_lastvisit'];
$lastvisit = date("D M j G:i Y", $lastvisit);

####Find####
'USERNAME' => $username,

####After Add####
'LASTVISIT' => $lastvisit,

Open /forums/templates/**template you use/memberlist_body.tpl
Code:
####Find####

<th class="thCornerR" nowrap="nowrap">{L_WEBSITE}</th>

####After Add####
<th class="thCornerR" nowrap="nowrap">Last Visit</th>

####Find####
<td class="{memberrow.ROW_CLASS}" align="center">&nbsp;{memberrow.WWW_IMG}&nbsp;</td>

####After Add####
<td class="{memberrow.ROW_CLASS}" align="center">&nbsp;{memberrow.LASTVISIT}&nbsp;</td>

####Find####
<td class="catbottom" colspan="8" height="28">&nbsp;</td>

####Replace With####
<td class="catbottom" colspan="9" height="28">&nbsp;</td>


If you want just admins to see it I suggest writing your own block to query the data needed from the database, it would be alot simpler than a further edit. The above shows the user_lastvisit time stored in the database for all users
 
montego
PostPosted: Sat Jan 08, 2005 8:12 am Reply with quote

ecvej, thank you sooooo much! I think it will be just fine if last visit is shown to everyone. This is exactly what I was looking for.

Groovy

montego
 
montego
PostPosted: Tue Jan 11, 2005 10:49 pm Reply with quote

ecvej wrote:
I did this with chatserves 6.9


I have 7.5 with Chatserv 2.8 and this is what I had to do.

Open Member_List folder, edit index.php:

Code:


####Find####
$cellcount = "8";

####Replace With####
$cellcount = "9";

####Find####
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar

####Replace With####
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar, user_lastvisit

####Find####
$username = $row['username'];

####After Add####
$lastvisit = $row['user_lastvisit'];
$lastvisit = date("D M j G:i Y", $lastvisit);

####Find####
'USERNAME' => $username,

####After Add####
'LASTVISIT' => $lastvisit,


Due to me using theme fisubsilversh, my memberlist_body.tpl is actually in a different spot, but if you are not using this theme, you may want to check out ecvej's post for the file to update. For me, I had to modify:

Open themes/fisubsilversh/forums/memberlist_body.tpl

Code:
####Find####

<th>{L_WEBSITE}</th>

####After Add####
<th>Last Visit</th>

####Find####
<td class="{memberrow.ROW_CLASS}" align="center">&nbsp;{memberrow.WWW_IMG}&nbsp;</td>

####After Add####
<td class="{memberrow.ROW_CLASS}" align="center">&nbsp;{memberrow.LASTVISIT}&nbsp;</td>

####The mentioned *catbody* change was not found or needed ####


Quote:
If you want just admins to see it I suggest writing your own block to query the data needed from the database, it would be alot simpler than a further edit. The above shows the user_lastvisit time stored in the database for all users


I just decided to not worry about everyone seeing the info. However, I noted one issue that I do not understand. Many of my users had a strange year in this field. For example, I had the following:

Code:


Wed Dec 31 17:00 1969


This is clearly an issue as my site has only been around since last September. Smile Is this an indication that the user has never logged back in after activating their account?

TIA,
montego
 
montego
PostPosted: Tue Jan 11, 2005 11:56 pm Reply with quote

I also decided to modify Member List to allow for sorting on the new Last Visit date field. Again, I am using 7.5 with Charserv 2.8 patches. Here is what has changed to accomplish this:

Open modules/Members_List/index.php:
Code:


####Find####
$mode_types_text = array($lang['Sort_Joined'], $lang['Sort_Username'], $lang['Sort_Location'], $lang['Sort_Posts'], $lang['Sort_Email'],  $lang['Sort_Website'], $lang['Sort_Top_Ten']);
$mode_types = array('joined', 'username', 'location', 'posts', 'email', 'website', 'topten');

####Replace With####
$mode_types_text = array($lang['Sort_Joined'], $lang['Sort_Username'], $lang['Sort_Location'], $lang['Sort_Posts'], $lang['Sort_Email'],  $lang['Sort_Website'], $lang['Sort_Top_Ten'], $lang['Sort_Last_Visit']);
$mode_types = array('joined', 'username', 'location', 'posts', 'email', 'website', 'topten', 'lastvisit');

####Find####
case 'topten':
                $order_by = "user_posts $sort_order LIMIT 10";
                break;

####Add After####
        case 'lastvisit':
                $order_by = "user_lastvisit $sort_order LIMIT $start, " . $board_config['topics_per_page'];
                break;



Open modules/Forums/language/lang_english/lang_main.php:

Code:


####Find####
//
// Memberslist
//

####Add at the bottom of this sections' list of defines####
$lang['Sort_Last_Visit'] = 'Last Visit Date';



That about does it! Works like a champ and I can now sort ascending or descending on this added field.

montego
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©