Jump to content

How do I see how many users logged in over last 30 days


Recommended Posts

Posted

I created a Member Stats page for admins only. What I did was go to the Block Manager/System and then selected Members and moved it over to my page. I then created a list for the last 25 members who visited. You can add more or less members if you want. Although it is not for a month like you are asking it gives you an idea who has visited within a month by just hovering over there name on the list. 

If you are interested in doing this I added a few screenshots for how to set it up:

1.thumb.png.6e42b8e21ef947facfffff674748f528.png

2.thumb.png.11d747f9b47b545bab581220ac61bd4a.png

Very easy to do. If you play around with it you can actually set up a few blocks giving you useful information. ;) 

Posted

If you truly just want the NUMBER of unique users that visited (with ids so logged in).  You can make a php block:

$monthago = time() - 2592000; //30days
$where = 'last_visit > '.$monthago;
try
{
$select = \IPS\Db::i()->select(
			'COUNT(*)',
			'core_members',
			$where
		);
}catch( \IPS\Db\Exception $e ){}
$countasarray = iterator_to_array($select);
print $countasarray[0];

 

Posted

Ok, so we are running  IP.Board 3.4.x and I run a sql query. This is just for my purpose and not to be broadcasted.

John

something like "Select count(*) from ipb_members where last_activity > (SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 30 day)))" ? correct.

Posted
1 hour ago, superj707 said:

Would it be better if your query select was 'COUNT(core_members') @clearvision

Well core_members is the table.   Only reason to filter on a specific column is if you don't want rows with null in that column. 

This does not try to detect state of member.  If you want specific member classes (rule out validating, banned, etc. ) the the where is more complicated.  If you have alot of false registrations hanging around may need to add more to it.

Edit: I can confirm that it will include validating members on 4.1 as they are part of your "entry" group.  It does not affect what I was doing as I also checked for a profile pix.  With 4.1 I'm not sure how you can tell if they are validating versus real members.  They evidently have guest privileges either set or with a flag (I don't see a flag on quick look) and since I don't need it, not going to dig for it...

 

Posted

My comment was for 4.x.  That might be right for 3.x, don't remember.

Also last_activity means they did something, versus they were just there (last_visit) if it matters (at least on 4.x)

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...