Adding Gender #'s to Who Is Online area of main page

Mod that adds a extra field to the users profile, the gender is displayed beside the posts

Moderator: Moderators

Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Adding Gender #'s to Who Is Online area of main page

Postby mguffey5 on Fri 01. Oct, 2004 05:30

Ok

I'm sure this has been asked before but I couldn't find it:

At the bottom of our main page on our board it shows:

Who is Online

under that it shows ofcourse who is online, who has a birthday today and upcoming birthdays

We want to add How many Male anf Female Registered Users and how many visitors we have had as well, like the website below:

http://pb.exocrew.com/haruko/index.php? ... de9ad5fefd

If you scroll to the bottom you will see where it says we have ** Female Members and ** Male Members

You will see below the Male/Female member part how many visitors

These last 2 sections are what we would like as well. I have no idea how to do this or what code to use or where to place it.

Thanks.
mguffey5
Poster
Poster
 
Posts: 4
Joined: Thu 23. Sep, 2004 01:31

Postby Raindrop on Thu 07. Oct, 2004 13:10

U can download it from phpbbhacks, here's the link: http://www.phpbbhacks.com/download/1771

I added it in my page too and I added the post made from males and the post made from females too; it looks like this:

We have 18 female members (425 posts) and 11 male members (326 posts)

This is my webpage: http://raindrop.altervista.org/forum/index.php

Check it if u want, but is in italian ;) (search "Battaglia dei sessi").

If u install the mod I linked and u like to show the posts too, here is the code to add it (my first one :D), hope it helps:

Code: Select all
#
#-----[ OPEN ]------------------------------------------------
#

includes/functions.php

#
#-----[ FIND ]------------------------------------------------
#

        case 'gender-male':
            $sql = "SELECT COUNT(user_id) AS total_male
                FROM " . USERS_TABLE . "
                WHERE user_gender = '1'";
            break;
        case 'gender-female':
            $sql = "SELECT COUNT(user_id) AS total_female
                FROM " . USERS_TABLE . "
                WHERE user_gender = '2'";
            break;

#
#-----[ AFTER ADD]--------------------------------------------
#

//mod male-female postcount
      case 'male-posts':
            $sql = "SELECT SUM(user_posts) AS total_male_posts
                FROM " . USERS_TABLE . "
                WHERE user_gender = '1'";
            break;
        case 'female-posts':
            $sql = "SELECT SUM(user_posts) AS total_female_posts
                FROM " . USERS_TABLE . "
                WHERE user_gender = '2'";
            break;
//mod male-female postcount

#
#-----[ FIND ]------------------------------------------------
#

        case 'gender-male':
            return $row['total_male'];
            break;
        case 'gender-female':
            return $row['total_female'];
            break;

#
#-----[ AFTER ADD]--------------------------------------------
#

//mod male-female postcount
      case 'male-posts':
            return $row['total_male_posts'];
            break;
        case 'female-posts':
            return $row['total_female_posts'];
            break;
//mod male-female postcount

#
#-----[ OPEN ]------------------------------------------------
#

index.php

#
#-----[ FIND ]------------------------------------------------
#

$total_male = get_db_stat('gender-male');
$total_female = get_db_stat('gender-female');

#
#-----[ AFTER ADD]--------------------------------------------
#

//mod male-female postcount
$total_male_posts = get_db_stat('male-posts');
$total_female_posts = get_db_stat('female-posts');
//mod male-female postcount

#
#-----[ FIND ]------------------------------------------------
#

if( $total_male == 0 )
{
   $l_total_male = $lang['male_zero_total'];
}
else if( $total_male == 1 )
{
   $l_total_male = $lang['male_one_total'];
}
else
{
   $l_total_male = $lang['male_total'];
}

if( $total_female == 0 )
{
   $l_total_female = $lang['female_zero_total'];
}
else if( $total_female == 1 )
{
   $l_total_female = $lang['female_one_total'];
}
else
{
   $l_total_female = $lang['female_total'];
}

#
#-----[ AFTER ADD]--------------------------------------------
#

//mod male-female postcount
if( $total_male_posts == 0 )
{
   $l_total_male_posts = $lang['male_zero_total_posts'];
}
else if( $total_male_posts == 1 )
{
   $l_total_male_posts = $lang['male_one_total_posts'];
}
else
{
   $l_total_male_posts = $lang['male_total_posts'];
}

if( $total_female_posts == 0 )
{
   $l_total_female_posts = $lang['female_zero_total_posts'];
}
else if( $total_female == 1 )
{
   $l_total_female_posts = $lang['female_one_total_posts'];
}
else
{
   $l_total_female_posts = $lang['female_total_posts'];
}
//mod male-female postcount

#
#-----[ FIND ]------------------------------------------------
#

'TOTAL_MALE' => sprintf($l_total_male, $total_male),
'TOTAL_FEMALE' => sprintf($l_total_female, $total_female),

#
#-----[ AFTER ADD]--------------------------------------------
#

//mod male-female postcount
'TOTAL_MALE_POSTS' => sprintf($l_total_male_posts, $total_male_posts),
'TOTAL_FEMALE_POSTS' => sprintf($l_total_female_posts, $total_female_posts),
//mod male-female postcount

#
#-----[ OPEN ]------------------------------------------------
#

language/lang_xxx/lang_main.php

#
#-----[ FIND ]------------------------------------------------
#

$lang['male_zero_total'] = 'We have <b>0</b> Male Member'; // # registered male users
$lang['male_total'] = 'We have <b>%d</b> Male Members'; // # registered male users
$lang['male_one_total'] = 'We have <b>%d</b> Male Member'; // # registered male users
$lang['female_zero_total'] = 'We have <b>0</b> Female Member'; // # registered female users
$lang['female_total'] = 'We have <b>%d</b> Female Members'; // # registered female users
$lang['female_one_total'] = 'We have <b>%d</b> Female Member'; // # registered female users

#
#-----[ AFTER ADD]--------------------------------------------
#

//mod male-female postcount
$lang['male_zero_total_posts'] = ' (<b>0</b> posts)'; // # posts from male users
$lang['male_total_posts'] = ' (<b>%d</b> posts)'; // # posts from male users
$lang['male_one_total_posts'] = ' (<b>%d</b> post)'; // # posts from male users
$lang['female_zero_total_posts'] = ' (<b>0</b> posts)'; // # posts from female users
$lang['female_total_posts'] = ' (<b>%d</b> posts)'; // # posts from female users
$lang['female_one_total_posts'] = ' (<b>%d</b> post)'; // # posts from female users
//mod male-female postcount

#
#-----[ OPEN ]------------------------------------------------
#

templates/xxx/index_body.tpl

#
#-----[ FIND ]------------------------------------------------
#

<br /><br /><b>Battle of the Sexes</b><br /><br />{TOTAL_FEMALE}<br />{TOTAL_MALE}

#
#-----[ REPLACE WITH ]----------------------------------------
#

<br /><br /><b>Battle of the Sexes</b><br /><br />{TOTAL_FEMALE} {TOTAL_FEMALE_POSTS}<br />{TOTAL_MALE} {TOTAL_MALE_POSTS}
Raindrop
Poster
Poster
 
Posts: 1
Joined: Sun 03. Oct, 2004 13:53

Postby GZP-Inc on Sun 17. Oct, 2004 20:55

i have the "gender stats on index" and "gender stats on ez portal" mods installed but they dont work, the numbers never change, does anyone know why it wouldnt work?
GZP-Inc
Poster
Poster
 
Posts: 2
Joined: Sun 17. Oct, 2004 20:51


Return to Gender [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron