简体   繁体   中英

Recreate/find a Joomla/Community Builder 'Latest Users' module. Dates in MySQL/Joomla

When Joomla first sprung up and I moved over from Mambo I remember finding a component called Community Builder (CB) that extends the user-based interface behind Joomla.

I remember a small module I found in CB that displayed a couple of useful details about users that I want to be able to extract from my current project. These details included:

  • Total users registered
  • Total users registered per day
  • Total users registered per week
  • Total users registered per month
  • Latest user registered
  • Total visitors to the site

My question is how to recreate something very similar. I've been trying to construct an SQL statement that can manipulate the user table results and compare them to a set criteria eg. find all user's with a ' registerDate ' variable within the last week.

The problem that has me lost is how to manipulate and compare a date string that resembles ' 2008-08-05 07:41:40 '

The problem that has me lost is how to manipulate and compare a date string that resembles '2008-08-05 07:41:40'

You can have MySQL turn this into a UNIX timestamp, or you can run it through strtotime.

MySQL:

SELECT UNIX_TIMESTAMP(datetime_field) FROM table

strtotime:

$timestamp = strtotime('2008-08-05 07:41:40');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM