1
davidtillyer
NEW & TOTAL member registration block

Hi ALL I need your help,
I'm trying to achaive a "Registration" block. In this block it has just 2 lines
"New Members Today"
and
"Total Members" Now I think the PHP code for this is:

$total = $member_handler->getUserCount(new Criteria('level', 0, '>'));
include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";

As I have picked this up from the top of the search module as this give a count as to the number of members you have registered on your site.

But can I do the same thing in HTML, which is easy for me as i just past this into the HTML code box of the block.

Two Questions

Q1: Is this the correct code above for "Total Members" (but it's in PHP)

Q2: What would the code be for "New Members Today"?

2
Mithrandir
Re: NEW & TOTAL member registration block

drop the include - that's for including the XoopsForm framework for easy form building.

Your code for a PHP block (do you mean a custom PHP block or one in a module?) should be this:

$member_handler =& xoops_gethandler('member');

$criteria = new Criteria('level'0'>');
$total $member_handler->getUserCount($criteria);

$midnight mktime(000date('n'time()), date('j'time()), date('Y'time()));
$criteria = new CriteriaCompo($criteria);

$criteria->add(new Criteria('user_regdate'$midnight">"));
$newtoday $member_handler->getUserCount($criteria);

Depending on whether you are using a custom PHP block or a block in a module, the way to display it will be a little different.

3
davidtillyer
Re: NEW & TOTAL member registration block

Thank you, for the code. As this is PHP script I can NOT just add this to the "HTML" window when I'm creating a new block.

I have tryed this at set the(Content Type) to PHP script and the block dose not appare on the site.

Do I need to save this code as a .PHP file on the site server and some how link my custom block to that?

4
Mithrandir
Re: NEW & TOTAL member registration block

There is no output in the PHP code.

If you just want this in a custom PHP block, you should add something like this to the end of the code:

echo "Total Members: ".$total;
echo 
"Members Today: ".$newtoday;

5
davidtillyer
Re: NEW & TOTAL member registration block

Thank you, for your help that worked it was just what I wanted.

Login

Who's Online

116 user(s) are online (100 user(s) are browsing Support Forums)


Members: 0


Guests: 116


more...

Donat-O-Meter

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

Latest GitHub Commits