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

Recent

Welcome to TinyPortal. Please login or sign up.

June 25, 2024, 11:21:50 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,280
  • Total Topics: 21,227
  • Online today: 203
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 176
  • Total: 176

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.

Shadow

You can add that to the statue block?

Ghostwriter

What code would I be looking for to replace? or add to?

JPDeni

That statsbox is defined in TPortalBlocks.template.php, function TPortal_statsbox.

Shadow

What code are we looking for in that file? Before we add that code to the status box?

Tommy

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'])' ?

IchBin

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

Tommy

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

IchBin

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
}

Tommy

Ooopsala - that's it!   O0
Thank you IchBin !

deef

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