Your ultimate PunBB resource!
You are not logged in.
## 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. ## ##
Offline
Language files are in polish, but I think You will guess what those variables mean. ![]()
Offline
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
<?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
Offline
Thank you for hint.
I think I dont have to add 'default' value in database. If table row is empty you will see 'unknown sex' in profile.
Ill correct some mistakes and upgrade mod to 1.1 soon.
Please , tell me... Does this mod work right? ![]()
Last edited by Louner (2006-05-07 12:39:25)
Offline
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 = ...
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.
Offline
i ve add a little correction to the checkbox in profile when we use firefox:
in the readme, operation 22:
<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:
<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
it will be usefull to make it compatible to version 1.2.14 soon
Offline
it would be usfull to read stickys soon.
http://www.punres.org/viewtopic.php?id=1098
Offline
can someone add couples to this mod?
we got male female now i need couples...
lol..
Q
Offline
what i do wrong?
and when i copy common.php do language my site dont work ;/
Offline
'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 07:36:42)
Offline
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:
// 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:
// 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-25 20:21:38)
Offline
my problem same with binczu post.
after i add this in lang
'MaleFemale' => 'Płeć', 'Male' => 'Mężczyzna', 'Female' => 'Kobieta',
it's become while page. please.. anybody know how to solve.
Offline
Find...
'Posted' => 'Posted' // The date/time a topic was started
Replace with
'Posted' => 'Posted', // The date/time a topic was started 'MaleFemale' => 'Plec', 'Male' => 'Mezczyzna', 'Female' => 'Kobieta',
Offline
solved. thank you my friend.
Offline