TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,965
  • Latest: boruko
Stats
  • Total Posts: 195,980
  • Total Topics: 21,320
  • Online today: 567
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 151
  • Total: 151

New members Block

Started by akulion, October 09, 2006, 07:08:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

akulion

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>';



jacortina

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

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

Get rid of the <h6> tags you put in there. ;)

MeRcChRiS

can you add the

Total Members:

in that last code also

hanzboer

Thanx for the code... It works well on my forum (http://ausaid-students.co.nr)

cheers!

bluedevil

This works pretty good on my site too :up:

OzButcher

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! :)

alhaudhie

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....

JPDeni

It depends on where you want it. If you want it in a block, put it in a php block.

Shadow

Which code is correct to use?

JPDeni

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.

This website is proudly hosted on Crocweb Cloud Website Hosting.