Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.7
Author Message
t_henson
Regular
Regular



Joined: Feb 02, 2007
Posts: 65
Location: Cincinnati, Ohio

PostPosted: Wed Feb 07, 2007 2:49 pm Reply with quote

im trying to find out how i can retrieve the users last visit time, and also the users total post count.
 
View user's profile Send private message
montego
Site Admin



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

PostPosted: Wed Feb 07, 2007 5:53 pm Reply with quote

These are on the nuke_users table as properties user_posts and user_lastvisit.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
Gremmie
Former Moderator in Good Standing



Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Wed Feb 07, 2007 6:10 pm Reply with quote

Be aware that user_lastvisit is apparently only updated when the user visits the phpBB forums. I was going to write a script to delete members who stopped visiting the site after x months, and was going to use that field. But then a member who submits news stories on a regular basis came up on the list of people to delete. After scratching my head for a while, I determined that was something that was added for phpBB. Nuke doesn't really use it. Maybe that is good enough for what you want though.

_________________
GCalendar - An Event Calendar for PHP-Nuke
Member_Map - A Google Maps Nuke Module 
View user's profile Send private message
gotcha
Regular
Regular



Joined: Mar 14, 2005
Posts: 91

PostPosted: Thu Feb 08, 2007 4:26 pm Reply with quote

That would be useful to have it work throughout the whole site.
Could probably do this by adding something like this to the header.php

Code:


if (is_user($user) && $name != 'Forums')
{
  $cookie = cookiedecode($user);
  $user_id = intval($cookie[0]);
  $sql = "UPDATE ".$user_prefix."_users SET user_lastvisit='".time()."' WHERE user_id='$user_id'";
  if (!$db->sql_query($sql))
  {
      // error updating
  }

}
 
View user's profile Send private message Visit poster's website
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Thu Feb 08, 2007 10:30 pm Reply with quote

Note that this could affect the usage of the forums, as phpBB uses that to determine which posts it counts as "new"

_________________
- Star Wars Rebellion Network -

Need help? Nuke Patched Core, Coding Services, Webmaster Services 
View user's profile Send private message Visit poster's website
gotcha







PostPosted: Thu Feb 08, 2007 11:37 pm Reply with quote

Probably be best to just add a new field then Smile
 
evaders99







PostPosted: Sun Feb 11, 2007 10:14 pm Reply with quote

If you're looking for code to use, Protector used a field called 'last_seen_blocker' which stored the last seen time as a timestamp. That's what I use for some of my scripts
 
t_henson







PostPosted: Mon Feb 12, 2007 3:46 pm Reply with quote

well my site basically revolves around the forums, so user_lastvisit will work fine for me. but im still new to php, and i was wondering how i go about getting the user_posts and user_lastvisit properties from the nuke_users table.

i just want to add on to the user info block to say:

last visit: last visit date here
total post: total post count here

sorry for being a newb lol. thanks guys.
 
t_henson







PostPosted: Tue Feb 13, 2007 4:12 am Reply with quote

okay with some patience i got it figured out, but the user_lastvisit shows up like 1171318172. any ideas?
 
Gremmie







PostPosted: Tue Feb 13, 2007 9:40 am Reply with quote

It is a unix timestamp (basically the number of seconds since an epoch date). There are many PHP functions that accept timestamps and do math on them.
 
t_henson







PostPosted: Tue Feb 13, 2007 1:47 pm Reply with quote

okay i got it all figured out. thanks for the help everyone.
 
myrtletrees
Involved
Involved



Joined: Sep 13, 2005
Posts: 259
Location: Cornfields of Indiana

PostPosted: Tue Apr 17, 2007 9:29 am Reply with quote

t_henson wrote:
okay i got it all figured out. thanks for the help everyone.


care to share?

Also, I noticed your Gallery is not working on your website. Just an FYI...
 
View user's profile Send private message
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.7

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 ©