PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#1 2006-05-07 14:47:15

Louner
New member
Registered: 2006-04-25
Posts: 3

Add male/female to profile view 1.0

Code:

##        Mod title:  MaleFemale
##
##      Mod version:  1.0
##   Works on PunBB:  1.2.11
##     Release date:  06-05-7
##           Author:  Louner [www.dragonrider.com.pl]
##
##      Description:  You can show your sex to everybody. :D
##
##       Affects DB:  Yes
##
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

Download here

Offline

 

#2 2006-05-07 14:53:03

Louner
New member
Registered: 2006-04-25
Posts: 3

Re: Add male/female to profile view 1.0

Language files are in polish, but I think You will guess what those variables mean. big_smile

Offline

 

#3 2006-05-07 18:46:27

gizzmo
Member
From: Earth, Milkyway Galaxy
Registered: 2004-08-05
Posts: 252

Re: Add male/female to profile view 1.0

you know there is an easyer way to select the sex, with out haveing to use a big bulky switch

at the end of the input add

Code:

<?php if($user['malefemale'] == 1) echo ' checked="checked" ';?>

and just change the number to what ever is needed. aka 1,2,3

also to make sure that every profile has their sex set to the default, add a default value in the database


Gizzmo

Offline

 

#4 2006-05-07 20:36:10

Louner
New member
Registered: 2006-04-25
Posts: 3

Re: Add male/female to profile view 1.0

Thank you for hint. smile

I think I dont have to add 'default' value in database. If table row is empty you will see 'unknown sex' in profile. smile

Ill correct some mistakes and upgrade mod to 1.1 soon. big_smile Please , tell me... Does this mod work right? smile

Last edited by Louner (2006-05-07 20:39:25)

Offline

 

#5 2006-05-07 23:22:37

gizzmo
Member
From: Earth, Milkyway Galaxy
Registered: 2004-08-05
Posts: 252

Re: Add male/female to profile view 1.0

also when you make a readme, use a fresh copy of punbb, with no mods.

The last steps, insted of useing a str_replace, just place under $username = ...

Code:

if($cur_post['malefemale'] == 1) $username .= '  <img src="img/male.gif" />';
elseif($cur_post['malefemale'] == 3) $username .= '  <img src="img/male.gif" />';

also maybe even use a drop down list to select the sex, insted of a radio button.


Gizzmo

Offline

 

#6 2006-05-22 14:03:15

n1c0
New member
Registered: 2006-05-07
Posts: 2

Re: Add male/female to profile view 1.0

i ve add a little correction to the checkbox in profile when we use firefox:

in the readme, operation 22:

Code:

 <label><?php echo $lang_common['MaleFemale'] ?><br />

                                  <?php

                                  switch($user['malefemale'])

                                  {

                                  case '1':



                                                           echo('<input type="radio" name="form[malefemale]" value="1" checked="checked" /> '.$lang_common['Male'].'<br />');

                                                           echo('<input type="radio" name="form[malefemale]" value="2" /> '.$lang_common['Female'].'<br />');

                                                           echo('<input type="radio" name="form[malefemale]" value="0" /> '.$lang_profile['Unknown'].'<br />');



                                                        break;

                                  case '2':



                                                           echo('<input type="radio" name="form[malefemale]" value="1" /> '.$lang_common['Male'].'<br />');

                                                           echo('<input type="radio" name="form[malefemale]" value="2" checked="checked" /> '.$lang_common['Female'].'<br />');

                                                           echo('<input type="radio" name="form[malefemale]" value="0" /> '.$lang_profile['Unknown'].'<br />');



                                                        break;

                                                        default:



                                                           echo('<input type="radio" name="form[malefemale]" value="1" /> '.$lang_common['Male'].'<br />');

                                                           echo('<input type="radio" name="form[malefemale]" value="2" /> '.$lang_common['Female'].'<br />');

                                                           echo('<input type="radio" name="form[malefemale]" value="0" checked="checked" /> '.$lang_profile['Unknown'].'<br />');



                                                           break;

                                                           }

                                                        ?>

                                                        </label>

replace with:

Code:

 
                            <label><?php echo $lang_common['MaleFemale'] ?><br /></label>

                          <?php

                           echo '<input type="radio" name="form[malefemale]" value="1" ';

                                      if($user['malefemale']==1) echo 'checked="checked"';

                                      echo ' /> '.$lang_common['Male'].'<br />' ;

                                  echo '<input type="radio" name="form[malefemale]" value="2" ';

                                       if($user['malefemale']==2) echo 'checked="checked"';

                                       echo ' /> '.$lang_common['Female'].'<br />' ;

                                  echo '<input type="radio" name="form[malefemale]" value="0" ' ;

                                       if($user['malefemale']==0) echo 'checked="checked"';

                                       echo ' /> '.$lang_profile['Unknown'].'<br />' ;

                     ?>

it seems that </label> must be  before the checkbox

Offline

 

#7 2006-11-15 04:34:03

Blood Angel
New member
Registered: 2006-11-15
Posts: 5

Re: Add male/female to profile view 1.0

it will be usefull to make it compatible to version 1.2.14 soon

Offline

 

#8 2006-11-15 11:03:54

Mark
Moderator
From: North West England
Registered: 2005-06-06
Posts: 1165

Re: Add male/female to profile view 1.0

it would be usfull to read stickys soon.

http://www.punres.net/viewtopic.php?id=1098


Cant find something you want? try searching
Also try the wiki

Offline

 

#9 2007-05-22 17:15:27

quaker
Member
From: Bama,USA
Registered: 2006-02-23
Posts: 968
Website

Re: Add male/female to profile view 1.0

can someone add couples to this mod?
we got male female now i need couples...

lol..


Q


My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Offline

 

#10 2007-05-22 18:00:27

Mark
Moderator
From: North West England
Registered: 2005-06-06
Posts: 1165

Re: Add male/female to profile view 1.0

just add another box for couples and add a section into the db for it


Cant find something you want? try searching
Also try the wiki

Offline

 

#11 2007-10-19 14:39:46

binczu
Member
Registered: 2007-09-27
Posts: 19

Re: Add male/female to profile view 1.0

what i do wrong?

http://i23.tinypic.com/e0nyif.jpg

and when i copy common.php do language my site dont work ;/

Offline

 

#12 2007-10-19 14:57:43

quaker
Member
From: Bama,USA
Registered: 2006-02-23
Posts: 968
Website

Re: Add male/female to profile view 1.0

did u put the info into the lang file?

Q


My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Offline

 

#13 2007-10-19 15:07:46

binczu
Member
Registered: 2007-09-27
Posts: 19

Re: Add male/female to profile view 1.0

'MaleFemale' => 'Płeć',
'Male' => 'Mężczyzna',
'Female' => 'Kobieta',

i must paste this to

/lang/your_language/profile.php?

i add this only to
/lang/your_language/common.php

and when i put this in to language folder i have white site xD

Last edited by binczu (2007-10-19 15:36:42)

Offline

 

#14 2007-10-26 04:17:45

dboling
New member
From: East Stroudsburg, PA 18301
Registered: 2007-10-12
Posts: 7
Website

Re: Add male/female to profile view 1.0

I found a bug for the mod malefemale register page instructions.
not only do you need to insert the value for $malefemale into the users table you need to add the column entry in the insert string.
I found this error when I was unable to add a new user from the registration page.
I am running PunBB: 1.2.15 and after this fix everything seems to work.


open register.php

find:

Code:

// Add the user
        $db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.' , \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error());

Replace with:

Code:

// Add the user
        $db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit, malefemale) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.' , \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.', '.$malefemale.')') or error('Unable to create user', __FILE__, __LINE__, $db->error());

Save register.php

Done...

Last edited by dboling (2007-10-26 04:21:38)

Offline

 

#15 2009-08-26 11:31:09

mcommunity
Member
Registered: 2009-08-26
Posts: 15

Re: Add male/female to profile view 1.0

my problem same with binczu post.
after i add this in lang

Code:

'MaleFemale' => 'Płeć',
'Male' => 'Mężczyzna',
'Female' => 'Kobieta',

it's become while page. please.. anybody know how to solve.

Offline

 

#16 2009-08-26 12:39:10

StevenBullen
Moderator
Registered: 2005-09-13
Posts: 300
Website

Re: Add male/female to profile view 1.0

Find...

Code:

'Posted'                =>    'Posted'    // The date/time a topic was started

Replace with

Code:

'Posted'                =>    'Posted',    // The date/time a topic was started

'MaleFemale' => 'Plec',
'Male' => 'Mezczyzna',
'Female' => 'Kobieta',

Blog - Follow Me and FluxBB on Twitter

Offline

 

#17 2009-08-26 14:06:15

mcommunity
Member
Registered: 2009-08-26
Posts: 15

Re: Add male/female to profile view 1.0

solved. thank you my friend.

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.