1
deka87
Daily submissions block
  • 2009/4/21 10:42

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Hi, I need a block that would show recent submissions like this: "There's been 5 news, 10 articles, 8 downloads, 20 terms submitted today".

any ideas?
Mind anchors

2
trabis
Re: Daily submissions block
  • 2009/4/21 12:55

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Just create the block and add it to an existent module, or create new module to hold the block.

You don't need to use module handlers, you can use queries like SELECT COUNT... FROM ... WHERE datefield > 24hoursago

Look at news module story class and look for stats method to get more ideas.




3
trabis
Re: Daily submissions block
  • 2009/4/21 13:00

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


You can also look at mypoints plugins.
Here is one example:
function news_useritems_count($uid$since)
{
    global 
$xoopsDB;
    list(
$ret) = $xoopsDB->fetchRow($xoopsDB->query("SELECT  COUNT(*)  FROM ".$xoopsDB->prefix("stories")." WHERE (uid='$uid' AND published > '$since')"));
    return 
$ret;
}


Since must be a valid timestamp
$since = time() - 24*60*60;
will give last 24 hours (not today).


Login

Who's Online

411 user(s) are online (326 user(s) are browsing Support Forums)


Members: 0


Guests: 411


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits