PDA

View Full Version : New user help


Boofo
06-03-2004, 10:40 PM
I have a strange request here that I'm hoping someone can help me with. First of all, here is the code I am currently working with:


require_once('./includes/functions_misc.php');
$timestamp = vbmktime(0, 0, 0, vbdate('m', TIMENOW, false, false), vbdate('d', TIMENOW, false, false), vbdate('Y', TIMENOW, false, false));

// <!-- NEW REGISTRATIONS TODAY -->
$newestusers = $DB_site->query_first("
SELECT COUNT(*) AS count
FROM " . TABLE_PREFIX . "user
WHERE joindate >= $timestamp
");

$statscache['newusers'] = intval ($newestusers[count]);


Ok, this work like it is supposed to. The newuser will change at midnight for each user according to their time offset. The follwing code is where I am having the problem.

if($statscache['newusers'] > '0')
{
if ($bbuserinfo['userid'] == '1')
{
$statscache['newusers'] = sprintf("<a href=\"admincp/user.php?$session[sessionurl]do=find&amp;user[joindateafter]=%s\" target=\"_blank\">%d</a>", date('Y-m-d'), vb_number_format($statscache['newusers']));
}
else
{
$statscache['newusers'] = vb_number_format($statscache['newusers']);
}
}

The link to the newuser profile tells me it couldn't match the query. It doesn't go to the user's profile now. Can anyone please help me figure out how to make it work with the timestamp variable?

Boofo
06-05-2004, 07:49 AM
Nobody has any idea how I can accomplsh this? I am amazed. ;)

Xenon
06-05-2004, 01:35 PM
hmm, maybe the sprintf function part is wrong.

i don'T see something wrong really, but you may just replace it with:
$statscache['newusers'] = '<a href="admincp/user.php?' . $session[sessionurl] . 'do=find&amp;user[joindateafter]=' . date('Y-m-d') . '" target="_blank">' . vb_number_format($statscache['newusers']) . '</a>' ;

Boofo
06-05-2004, 03:21 PM
It's the same sprintf code they use in the Admin CP for newusers but they use $starttime with date instead of $timestamp with vbdate. I think the vbdate is what is messing it up. And you're right, the line not working is the sprintf line.

Boofo
06-08-2004, 12:24 AM
hmm, maybe the sprintf function part is wrong.

i don'T see something wrong really, but you may just replace it with:
$statscache['newusers'] = '<a href="admincp/user.php?' . $session[sessionurl] . 'do=find&amp;user[joindateafter]=' . date('Y-m-d') . '" target="_blank">' . vb_number_format($statscache['newusers']) . '</a>' ;
I just wanted to report back that this seemed to do the trick. Thank you very much, sir. ;)

Apparently vbdate doesn't like sprintf for some reason. ;)

Xenon
06-08-2004, 11:40 AM
you're welcome :)

*gg* i don't like the sprintf either, but i have to, when i write in c++ ^^