vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   New user help (https://vborg.vbsupport.ru/showthread.php?t=65805)

Boofo 06-03-2004 09:40 PM

New user help
 
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:

PHP Code:

require_once('./includes/functions_misc.php');
$timestamp vbmktime(000vbdate('m'TIMENOWfalsefalse), vbdate('d'TIMENOWfalsefalse), vbdate('Y'TIMENOWfalsefalse));
 
// <!-- 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.

PHP Code:

 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 06:49 AM

Nobody has any idea how I can accomplsh this? I am amazed. ;)

Xenon 06-05-2004 12:35 PM

hmm, maybe the sprintf function part is wrong.

i don'T see something wrong really, but you may just replace it with:
PHP Code:

$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 02: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-07-2004 11:24 PM

Quote:

Originally Posted by Xenon
hmm, maybe the sprintf function part is wrong.

i don'T see something wrong really, but you may just replace it with:
PHP Code:

$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 10:40 AM

you're welcome :)

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


All times are GMT. The time now is 03:48 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02528 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete