TinyPortal

Development => Block Codes => Topic started by: akulion on October 09, 2006, 07:08:23 PM

Title: New members Block
Post by: akulion on October 09, 2006, 07:08:23 PM
Hi

I've seen this on a few joomla based sites where you get something like:

Total Members 233234
New This Month:123
New This Week: 45
New Today: 8

Can someone make something similar for inclusion with the stats box?

Aku
Title: Re: New members Block
Post by: knat on October 09, 2006, 07:16:01 PM
i would love to have this block - much credit to the one who creates the code  :coolsmiley:
Title: Re: New members Block
Post by: JPDeni on October 09, 2006, 09:58:37 PM
This is separate code, but you could put it wherever you wanted:

global $db_prefix,$modSettings;

$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo 'Total Members: ', $modSettings['totalMembers'],'<br />';
echo 'New This Month: ', $row['month'],'<br />';
echo 'New This Week: ', $row['week'],'<br />';
echo 'New Today: ', $row['today'];


It also returns the number for the year. I figured I'd go ahead and get the data just in case someone might want it.
Title: Re: New members Block
Post by: akulion on October 09, 2006, 10:02:21 PM
Thanks

ill try it out asap :D
Title: Re: New members Block
Post by: akulion on October 09, 2006, 10:06:43 PM
no workie

gving stats:

Total Members: 1039
New This Month: 0
New This Week: 0
New Today: 0

and today 3 people joined up and this week according to my approximation about 5 to 7 people joined up

and for the moth the stats show:  19 people joined

but it shows zero for all
Title: Re: New members Block
Post by: JPDeni on October 09, 2006, 10:10:31 PM
:sigh:

Back to the drawing board, I guess. :)
Title: Re: New members Block
Post by: akulion on October 09, 2006, 10:12:23 PM
dont worry atleast u got 88.543% of the code working (according to my calculations) :up:
Title: Re: New members Block
Post by: JPDeni on October 09, 2006, 10:14:03 PM
Let's try it again. I left out a little minor detail.  ::)

Instead of
db_query("SELECT

use

$query = db_query("SELECT

That should do it. I'll edit the original code.
Title: Re: New members Block
Post by: akulion on October 09, 2006, 10:18:54 PM
now it is working 98.945%

the reason i say this is cos today someone joined my forum in front of me (about 2 hours back) and made a lotta posts and requested dance songs on the online radio as well lol

but it shows:
Total Members: 1039
New This Month: 18
New This Week: 7
New Today: 0
Title: Re: New members Block
Post by: JPDeni on October 09, 2006, 10:22:54 PM
What time is it where you are? Or, better still, what time is it where your server is? The day is the calendar day as defined by your server. So, if it's after midnight wherever your server is, you won't get anybody who registered before midnight. We could change it to "within the last 24 hours."
Title: Re: New members Block
Post by: akulion on October 09, 2006, 10:27:05 PM
nope dosent seem to be the issue

i just used opera to register a new member
and the counter for tody still at 0

but week and month progressed forward by 1
Title: Re: New members Block
Post by: JPDeni on October 09, 2006, 10:31:03 PM
Is the account activated?

The only thing you can do is change

$today = strtotime("today");

to

$today = strtotime("24 hours ago");

which will give you the number of registrations within a rolling 24-hour period. I know that the strtotime("today") code gives the Unix time for midnight on the current calendar day.
Title: Re: New members Block
Post by: Jpg on October 09, 2006, 10:32:29 PM
Nice...me likey...I might add this to the boardindex!! WOOT WOOT!

[Nice idea for a mod]
Title: Re: New members Block
Post by: akulion on October 09, 2006, 10:33:06 PM
holy cazambo gubu gubu!!! IT WORKS!!!
(whatever tht means - i just made it up!)


Total Members: 1040
New This Month: 19
New This Week: 8
New Today: 5

:D Thanks so much!! ur the best!! :D
Title: Re: New members Block
Post by: Jpg on October 09, 2006, 10:47:53 PM
LMAO....
You get alot of members....daaaamn..

Good it works now.
Great work Just Plain.
I like the idea/concept. *Gives Thumbs Up*
Title: Re: New members Block
Post by: JPDeni on October 09, 2006, 10:50:54 PM
 :2funny:

What did you do, aku? Did you change it to 24 hours?

Glad it worked for you.  ;D

Glad you like it too, Jpg.

It worked out nicely because I just really understood something new (to me) in mysql and it was what made this work. It's great when I'm able to apply something I've just learned.
Title: Re: New members Block
Post by: akulion on October 09, 2006, 10:55:51 PM
yes the 24 hour one worked :D

thanks again :D

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi26.photobucket.com%2Falbums%2Fc147%2Fjbrowning%2Fchewy.gif&hash=4796439a333fc2cbf1f348b912f4e82ad440b08c) (http://path-to-peace.net/forum)<<<-- Demo click the dude

and then look in left bar at the bottom near the stats
Title: Re: New members Block
Post by: rbh on October 10, 2006, 04:01:36 AM
i tweaked the code a little and placed it within my stats box, but i cannot get it to '
';

look at the picture and right after the latest members name you will see what i mean where it says Kalo then new this month. i have placed the break code in several places but it wont return the next line. any suggestions? thanks


here is my template code with the added above code
   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>'.$txt[19].'</b></a>
                 <br />'.$bullet.$txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet.$txt['tp-latest']. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';
       if(isset($context['TPortal']['userbox']['stats_all']))
global $db_prefix,$modSettings;

$today = strtotime("today");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo 'New This Month: ', $row['month'],'<br />';
echo 'New This Week: ', $row['week'],'<br />';
echo 'New Today: ', $row['today'];

Title: Re: New members Block
Post by: JPDeni on October 10, 2006, 05:25:21 AM
echo '<br />New This Month: ', $row['month'],'<br />';

That should do it.
Title: Re: New members Block
Post by: rbh on October 10, 2006, 02:59:24 PM
that did the trick, thanks ;D just one more little thing if you don't mind. i have been trying to add bullets in front of the stats to match the rest of the stats box. i have gotten the bullets to show up in a couple different places, but not in the front of the text, and i have gotten parse errors at least 10 times. :-\ where would i place the $bullet to make it show before the stats text? thanks again.
Title: Re: New members Block
Post by: JPDeni on October 10, 2006, 03:17:35 PM
You can try:

echo '<br />',$bullet,'New This Month: ', $row['month'],'<br />';
echo $bullet,'New This Week: ', $row['week'],'<br />';
echo $bullet,'New Today: ', $row['today'];


You shouldn't get a parse error with those.

Glad to help. :)
Title: Re: New members Block
Post by: rbh on October 10, 2006, 03:43:24 PM
worked like a charm. i was so close and had it in the right spot a couple times but was using $bullet. instead of $bullet, only because i saw in other parts of the template the period was used with $bullet

thank you! it looks like it belongs now. :)
Title: Re: New members Block
Post by: JPDeni on October 10, 2006, 03:48:29 PM
You should be able to use the period or the comma, although the comma supposedly makes it go faster. You may have missed out on a single quote somewhere. Or maybe the gremlins were acting up.  ;)
Title: Re: New members Block
Post by: akulion on October 10, 2006, 03:58:29 PM
yes the logic behind the comm and period is as follows:

the . is like a pebble so it can cause your php to slow down

however the , is like a slide so the php zooms by on it

:up:
Title: Re: New members Block
Post by: rbh on October 10, 2006, 03:59:35 PM
i have no doubts i had something wrong, but thats why i come here to lean on you guys.  ;) i try it myself for awhile and when the butchering doesn't work i count on the help here to get the ship righted. when it comes to hardware i do just fine, building and working on pcs, but when it comes to codes i am a drooling gurgling infant that just feels totally helpless sometimes. ;D between bloc, ichbin, akulion, and others i have yet to not resolve an issue no matter how simple the question or hard the answer and the help comes extremely fast. :up: :up:
Title: Re: New members Block
Post by: akulion on October 10, 2006, 04:02:16 PM
i was just joking about the comma and period :P lol
Title: Re: New members Block
Post by: JPDeni on October 10, 2006, 04:09:51 PM
Quotethe . is like a pebble so it can cause your php to slow down
:2funny:

Well, that's a way to remember it, I guess.  ;D

QuoteI try it myself for awhile and when the butchering doesn't work i count on the help here to get the ship righted
That's the way to do it. I love helping people like you. And when I have problems with hardware, I'll know just who to ask.  ;)
Title: Re: New members Block
Post by: MeRcChRiS on October 17, 2006, 11:59:31 PM
ok my text is real small with this block code, check it http://carnage.sector-wars.com/oforums/index.php?action=forum (http://carnage.sector-wars.com/oforums/index.php?action=forum)

how do i make the text like my other text? or change the size
Title: Re: New members Block
Post by: rebelrose on October 18, 2006, 12:12:26 AM
Quote from: MeRcChRiS on October 17, 2006, 11:59:31 PM
http://carnage.sector-wars.com/oforums/index.php?action=forum (http://carnage.sector-wars.com/oforums/index.php?action=forum)


your link is incorrect
Title: Re: New members Block
Post by: MeRcChRiS on October 18, 2006, 12:19:16 AM
You sure? i just clicked it and it took me there O.o

Anyways, try this one i guess

http://carnage.sector-wars.com/oforums/index.php? (http://carnage.sector-wars.com/oforums/index.php?)
Title: Re: New members Block
Post by: akulion on October 18, 2006, 12:39:41 AM
u could try this:

echo '<font size="12">New This Month: ', $row['month'],'<br />';
echo 'New This Week: ', $row['week'],'<br />';
echo 'New Today: ', $row['today'],'</font>';


Title: Re: New members Block
Post by: jacortina on October 18, 2006, 12:45:14 AM
Quote from: MeRcChRiS on October 17, 2006, 11:59:31 PM
ok my text is real small with this block code, check it http://carnage.sector-wars.com/oforums/index.php?action=forum (http://carnage.sector-wars.com/oforums/index.php?action=forum)

how do i make the text like my other text? or change the size

Get rid of the <h6> tags you put in there. ;)
Title: Re: New members Block
Post by: MeRcChRiS on October 18, 2006, 12:52:36 AM
can you add the

Total Members:

in that last code also
Title: Re: New members Block
Post by: hanzboer on October 18, 2006, 03:02:58 AM
Thanx for the code... It works well on my forum (http://ausaid-students.co.nr)

cheers!
Title: Re: New members Block
Post by: bluedevil on October 18, 2006, 11:14:22 PM
This works pretty good on my site too :up:
Title: Re: New members Block
Post by: OzButcher on November 28, 2006, 05:51:32 PM
Quote from: rbh on October 10, 2006, 04:01:36 AM
i tweaked the code a little and placed it within my stats box, but i cannot get it to '
';

look at the picture and right after the latest members name you will see what i mean where it says Kalo then new this month. i have placed the break code in several places but it wont return the next line. any suggestions? thanks


here is my template code with the added above code
   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>'.$txt[19].'</b></a>
                 <br />'.$bullet.$txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet.$txt['tp-latest']. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';
       if(isset($context['TPortal']['userbox']['stats_all']))
global $db_prefix,$modSettings;

$today = strtotime("today");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo 'New This Month: ', $row['month'],'<br />';
echo 'New This Week: ', $row['week'],'<br />';
echo 'New Today: ', $row['today'];



I would also like to get it working this way. Can you tell me which files you edited? I thought it might be in Stats.php but couldnt find where that code belongs. Cheers! :)
Title: Re: New members Block
Post by: alhaudhie on December 04, 2006, 04:57:31 PM
Quote from: JPDeni on October 09, 2006, 09:58:37 PM
This is separate code, but you could put it wherever you wanted:

global $db_prefix,$modSettings;

$today = strtotime("today");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo 'Total Members: ', $modSettings['totalMembers'],'<br />';
echo 'New This Month: ', $row['month'],'<br />';
echo 'New This Week: ', $row['week'],'<br />';
echo 'New Today: ', $row['today'];


It also returns the number for the year. I figured I'd go ahead and get the data just in case someone might want it.

where must i put it....
Title: Re: New members Block
Post by: JPDeni on December 04, 2006, 06:12:23 PM
It depends on where you want it. If you want it in a block, put it in a php block.
Title: Re: New members Block
Post by: Shadow on February 26, 2007, 03:43:24 AM
Which code is correct to use?
Title: Re: New members Block
Post by: JPDeni on February 26, 2007, 02:20:11 PM
Use the first code in the topic. I've made changes to it as errors were found. If you have a problem, post your problem and we'll get it worked out.
Title: Re: New members Block
Post by: Shadow on February 26, 2007, 09:34:33 PM
Alright, I have one tiny problem's. I have 24 new member's join the forum this month.

The code saying I have 23 new member's join this month.

New this week.  I have two new this week and the code saying i have one new this week.
Title: Re: New members Block
Post by: JPDeni on February 26, 2007, 09:55:57 PM
Tell me which days this week you've had new members join. Was it Sunday and Monday or two on Monday? How about this month? Did you have one on the first day of the month?

Title: Re: New members Block
Post by: Shadow on February 26, 2007, 09:59:58 PM
This month i have 24 member's join the forum.   I have two new member's join this week.  I think one on money and anther last night or so.
Title: Re: New members Block
Post by: JPDeni on February 26, 2007, 10:02:42 PM
I need to know whether you had one on the first of the month or one on Sunday. I need specific information in order to be able to trouble-shoot the code.
Title: Re: New members Block
Post by: Shadow on February 26, 2007, 10:05:21 PM
Last tueday they join the forum..
Title: Re: New members Block
Post by: JPDeni on February 26, 2007, 10:07:24 PM
Oh. Well last Tuesday isn't part of this week. "This week" starts on Sunday. Or did you want "within the past 7 days" instead of "this week"? They mean two very different things.
Title: Re: New members Block
Post by: Shadow on February 26, 2007, 10:09:25 PM
I'm sorry, I didn't know that.  Yes, I want it then 7 week day's
Title: Re: New members Block
Post by: JPDeni on February 28, 2007, 06:18:47 PM
Sorry. I didn't see your post before. You can change the time frames to match what you want. The original code is


date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');


You can change it to


$thismonth = strtotime("30 days ago");
$thisweek = strtotime("7 days ago");
$thisyear = strtotime("1 year ago");
Title: Re: New members Block
Post by: Ghostwriter on April 01, 2007, 07:57:33 PM
I was wondering if I added this to the stats box where do I add it in there is no place to add code, just the title and then what you want showing.
Title: Re: New members Block
Post by: IchBin on April 01, 2007, 08:13:54 PM
You have to add the code manually. TPortalBlocks.template.php is where thats at.
Title: Re: New members Block
Post by: Shadow on April 02, 2007, 12:36:14 AM
You can add that to the statue block?
Title: Re: New members Block
Post by: Ghostwriter on April 02, 2007, 03:32:46 AM
What code would I be looking for to replace? or add to?
Title: Re: New members Block
Post by: JPDeni on April 02, 2007, 03:38:42 AM
That statsbox is defined in TPortalBlocks.template.php, function TPortal_statsbox.
Title: Re: New members Block
Post by: Shadow on April 02, 2007, 03:40:52 AM
What code are we looking for in that file? Before we add that code to the status box?
Title: Re: New members Block
Post by: Tommy on June 05, 2007, 08:01:27 PM
Nice Code !!  :) Just have some problems with the things I've added:


/*
1. Gaeste bekommen ForumStats angezeigt.
2. Mitglieder die Begruessungsbox
3. Admins die NeuRegistrierungen
*/

global $context,$db_prefix,$modSettings;

if ($context['user']['is_guest'])

TPortal_statsbox();

else if ($context['user']['is_logged'] && !$context['user']['is_admin'])

TPortal_userbox();

else if ($context['user']['is_admin'])

$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo '<div style="text-align: center;"><span
style="font-weight: bold; text-decoration: underline;">Admin-Info</span></div>';
echo 'Mitglieder: ', $modSettings['totalMembers'],'<br />';
echo 'Neue/Monat: ', $row['month'],'<br />';
echo 'Neue/Woche: ', $row['week'],'<br />';
echo 'Neue/Heute: ', $row['today'];


The result is that my forum don't wants to load  :( Maybe something wrong with the 'else if ($context['user']['is_logged'] && !$context['user']['is_admin'])' ?
Title: Re: New members Block
Post by: IchBin on June 05, 2007, 11:13:55 PM
I think your else if statements need an else statement. 

Not 100% sure, but I think any time you start and if statement with else if you have to finish with else.

if

else if

else if

else
Title: Re: New members Block
Post by: Tommy on June 07, 2007, 12:55:15 PM
Thanks for your answer!

But the problem still exists:

/*
1. Gaeste bekommen ForumStats angezeigt.
2. Mitglieder die Begruessungsbox
3. Admins die NeuRegistrierungen
#############################
by Tommy
#############################
*/

global $context,$db_prefix,$modSettings;

if ($context['user']['is_guest'])

TPortal_statsbox();

else if ($context['user']['is_logged'] && !$context['user']['is_admin'])

TPortal_userbox();

else
//if ($context['user']['is_admin'])

$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo '<div style="text-align: center;"><span
style="font-weight: bold; text-decoration: underline;">Admin-Info</span></div>';
echo 'Mitglieder: ', $modSettings['totalMembers'],'<br />';
echo 'Neue/Monat: ', $row['month'],'<br />';
echo 'Neue/Woche: ', $row['week'],'<br />';
echo 'Neue/Heute: ', $row['today'];
Title: Re: New members Block
Post by: IchBin on June 08, 2007, 01:27:48 AM
Your last else statement is only executing this line:
$today = strtotime("24 hours ago");

If you want the rest of the code to execute you'll need to enclose the code with brackets.

else
{
all your other code here
}
Title: Re: New members Block
Post by: Tommy on June 08, 2007, 12:30:02 PM
Ooopsala - that's it!   O0
Thank you IchBin !
Title: Re: New members Block
Post by: deef on June 12, 2007, 11:19:12 AM
Is there a way how I can add for example:

Female: 450
Male: 1200

I thougt to do it in:

'.$bullet. ' '.$modSettings['male']. '

'.$bullet. ' '.$modSettings['female']. '

The $bullet I wish to change to the male and female symbol (but where to do that ?) The text I have deleted becausse I have allreadye the male and female symbol.  But where I have to find this
$modSettings['male']

or where I have to make it ?  Or is there a other way ?

grtz,

deef
Title: Re: New members Block
Post by: asklife on June 12, 2007, 06:30:10 PM
txks. alot this really worked for my site, but i have a problem, codes work only for center block, it dont work for left & right block. does anyone has code for left & right block?

Edited:- it works for right block
Title: Re: New members Block
Post by: deef on June 13, 2007, 07:47:32 PM
Nobody a idea how to do this ?

Greetings,

Deef

Quote from: deef on June 12, 2007, 11:19:12 AM
Is there a way how I can add for example:

Female: 450
Male: 1200

I thougt to do it in:

'.$bullet. ' '.$modSettings['male']. '

'.$bullet. ' '.$modSettings['female']. '

The $bullet I wish to change to the male and female symbol (but where to do that ?) The text I have deleted becausse I have allreadye the male and female symbol.  But where I have to find this
$modSettings['male']

or where I have to make it ?  Or is there a other way ?

grtz,

deef

Title: Re: New members Block
Post by: Lord Anubis on January 21, 2008, 11:49:20 PM
Mine has a bit of a problem...

I had 8 people register today and it says 0, but the week and month are correct

it shows

New This Month: 164
New This Week: 19
New Today: 0

I dunno why it works with the other two and not that...Oh and I added it to a mini-user CP but I don't see how that could be the conflict

Check it out HERE (http://nextsite.org) it is the first block on the right and click stats

EDIT: NEVERMIND I FIXED IT

This is a great addition THANKS
Title: Re: New members Block
Post by: ranKoto on March 07, 2008, 02:09:29 PM
Hi all

im having this error using the code in the first page :

Database Error
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '= 1' at line 1
File: C:\apache2\htdocs\smf\Sources\Load.php(1771) : eval()'d code
Line: 558

any help please ..
Title: Re: New members Block
Post by: JPDeni on March 07, 2008, 02:35:58 PM
Please post the exact code you're using.
Title: Re: New members Block
Post by: ranKoto on March 07, 2008, 02:53:29 PM
Hi JPDeni

im using this code below

global $db_prefix,$modSettings;

$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo 'Total Members: ', $modSettings['totalMembers'],'<br />';
echo 'New This Month: ', $row['month'],'<br />';
echo 'New This Week: ', $row['week'],'<br />';
echo 'New Today: ', $row['today'];
Title: Re: New members Block
Post by: JPDeni on March 07, 2008, 04:58:41 PM
I was just trying to figure out how you got to line 558 in that code. I guess with the queries it's different.

I don't know what could be wrong. It's been a very long time since I wrote that, so I don't remember anything about it. But it looks like it should work.

Try turning off that block to see if there's any errors. The only thing I can think of is that other code is interfering with the function.
Title: Re: New members Block
Post by: ranKoto on March 08, 2008, 08:14:22 AM
i already removed this block, and as you said there was no error at all

other code ? you mean another block ? or mod ?

yes im tryin it in my testing forum which is full with other block and mod, ok ill try it first in other testing forum

it works in my other testing forum..thanks JPDeni
Title: Re: New members Block
Post by: JPDeni on March 08, 2008, 02:09:02 PM
Quoteother code ? you mean another block ? or mod ?
Yes, that's what I was thinking. Or possibly your theme.

If it works in your testing forum, then there is definitely something else that's interfering.
Title: Re: New members Block
Post by: ranKoto on March 09, 2008, 05:20:19 AM
i think it was the forum with all of the mod i used, in the new one i still used the same theme though ..

thanks again JPDeni :)