4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: brandkanne on June 02, 2003, 02:12:19 PM
-
be sure BACKUP your data first at all !!!!!!!
-------------------------------------------------
Mini MOD: User Gender Info Signs
Hi,
this is my first Mini MOD posting, so please don't hit me, if something wrong...
I add some user gender information like this:
Name1 (http://www.4homepages.de/forum/index.php?action=dlattach;topic=6000.0;id=24;image)
Name2 (http://www.4homepages.de/forum/index.php?action=dlattach;topic=6000.0;id=25;image)
Ok, here is the code:
Step 1
Add a new field "user_sex" in "4images_users" table
Step 1a!
At first setup, you must edit for each existing user the user_sex field by hand with m or w
i hope your database is not so huge :oops: (m=male, w=female)
Step 2
Open db_field_definitions.php
find
?>
add above
$additional_user_fields['user_sex'] = array($lang['user_sex'], "radio", 1);
Step 3
Open register_form.html
find
<form method="POST" action="{url_register}">
<table>
add after
<tr>
<td class="row1"><font size=-1> <b>Gender:</b></td>
<td class="row1">
<font size=-1>
<input type="radio" name="user_sex" value="m" checked />
male
<input type="radio" name="user_sex" value="w" />
female</font>
</td>
</tr>
Step 4
Save (http://www.4homepages.de/forum/index.php?action=dlattach;topic=6000.0;id=24;image) and (http://www.4homepages.de/forum/index.php?action=dlattach;topic=6000.0;id=25;image) from here
Step 5
Upload these two images to your default template directory
Step 6
Open member_profile.html
find
{user_name}
add after
<img src="templates/default/images/{user_sex}.gif">
I thing you can repeat Step 6 on any template file...
I guess thats all!
But if you use MOD Memberlist, try this too:
Step 7
find
case 'user_joindate':
$order_by = "user_joindate $sort_order";
break;
add above
case 'user_sex':
$order_by = "user_sex $sort_order";
break;
Step 8
find
$order_by = "user_name $sort_order";
replace with
$order_by = "user_sex $sort_order";
Step 9
find
while ($user_row = $site_db->fetch_array($result)){
$user_id = "";
add after
$user_sex = "";
Step 10
find a few lines below
$user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;
add above
$user_sex = "<img src=\"templates/default/images/".htmlspecialchars($user_row['user_sex']).".gif\">".$var_name." ";
Step 11
find a few lines below
$userlist .= "<td valign=\"top\" align=\"left\">".$session_ip." ".$user_name."</td>\n";
replace with
$userlist .= "<td valign=\"top\" align=\"left\">".$session_ip." ".$user_name." ".$user_sex."</td>\n";
I guess i forgot nothing... i hope so
be sure BACKUP your data first at all !!!!!!!
-
very nice! good job!
maybe good idea support this too: (http://www.4homepages.de/forum/index.php?action=dlattach;topic=6000.0;id=23;image)
;) u never know :D
P.S. moving this MOD into MODs forum ;)
-
:oops: maybe, maybe... (http://www.4homepages.de/forum/index.php?action=dlattach;topic=6000.0;id=23;image)
New additional...
Step 3
Save this sign too ((http://www.4homepages.de/forum/index.php?action=dlattach;topic=6000.0;id=23;image))
Open register_form.html
find
<form method="POST" action="{url_register}">
<table>
add after
<tr>
<td class="row1"><font size=-1> <b>Gender:</b></td>
<td class="row1">
<input type="radio" name="user_sex" value="b" checked />
not sure
<input type="radio" name="user_sex" value="m" />
male
<input type="radio" name="user_sex" value="w" />
female</font>
</td>
</tr>
but, in this case better is a new tag in member_editprofile.html
for opt. change gender later... or not? :D
-
Images not showing :(
I get the vicious RED X next to members name in profile.
:?: :?: :?:
the m.gif and w.gif ARE located in templates/default/images
folder
help please
Thanks inadvance
-
i'm sorry, but how do you add a new field to the database?
-
i'm sorry, but how do you add a new field to the database?
i use phpMyAdmin... http://phpwizard.net/projects/phpMyAdmin/
browse to your database in 4images_users
click on: Add new field: 1 At End of Table
choose varchar(1), set default to m
that's it.
-
Images not showing :(
I get the vicious RED X next to members name in profile.
:?: :?: :?:
the m.gif and w.gif ARE located in templates/default/images
folder
i guess, your probl. is the empty database field in user_sex for your existing users, right?
!
At first setup, you must edit each user_sex field by hand with m or w
i hope your database is not so huge :oops:
-
!
At first setup, you must edit each user_sex field by hand with m or w
i hope your database is not so huge :oops:
actualy when u are adding new field, just make default ('m')
if u already added that field, run this query to update all enteries:
UPDATE 4images_users SET user_sex = 'm'
-
just notised, instead of
<img src="templates/default/images/{user_sex}.gif">
better use this:<img src="{template_image_url}/{user_sex}.gif">
-
Hi!
Okay...my question is this...if we set the user to default as "male" is there a way for them to change it?
I added the field that we added to the register_form.html form to the member_editprofile.html. BUT....it resets back to the male selection because it is set as marked. Is there a way to recall what the user marked so they dont have to keep changing it everytime they update their profile. I'm sure many people will forget to mark Female if they are female everytime the update their profile.
Please help!
Thank you!
-
Post updated on: 19 June 2003, 03:21am
Hi!
Okay...my question is this...if we set the user to default as "male" is there a way for them to change it?
There is but it's going to require a few changes to the original mod.
First open: includes/db_field_definitions.php
Find:
$additional_user_fields['user_sex'] = array($lang['user_sex'], "radio", 1);
Change to:
$additional_user_fields['user_sex'] = array($lang['user_sex'], "text", 0);
Open: member.php
Find:
else {
$user_icq_button = REPLACE_EMPTY;
}
Below add:
// User Gender Switch
$gender_array = array("Male", "Female", "None Specified");
$user_gender = $gender_array[$user_row['user_sex']]." <img src=\"".TEMPLATE_PATH."/images/gender".$user_row['user_sex'].".gif\">";
Rename images to gender0.gif = male gender1.gif = female and gender3.gif = blank (nothing)
Find:
"lang_email" => $lang['email'],
"lang_homepage" => $lang['homepage'],
"lang_icq" => $lang['icq']
Change to:
"lang_email" => $lang['email'],
"lang_homepage" => $lang['homepage'],
"lang_icq" => $lang['icq'],
"user_gender" => $user_gender,
Find:
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'
Change to:
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq', user_sex = '$user_gender'
Find:
if ($config['account_activation'] == 2 && $user_info['user_level'] != ADMIN) {
$edit_profile_msg .= $lang['edit_profile_email_msg_admin'];
}
Below add:
// User Gender Switch
if($user_info['user_sex'] == 1){
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\" checked />
male
<input type=\"radio\" name=\"user_gender\" value=\"2\" />
female</font>";
} else if($user_info['user_sex'] == 2){
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\"/>
male
<input type=\"radio\" name=\"user_gender\" value=\"2\" checked />
female</font>";
} else {
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\"/>
male
<input type=\"radio\" name=\"user_gender\" value=\"2\"/>
female</font>";
}
Find:
"lang_edit_profile_msg" => $edit_profile_msg,
"lang_yes" => $lang['yes'],
"lang_no" => $lang['no']
Replace with:
"lang_edit_profile_msg" => $edit_profile_msg,
"lang_yes" => $lang['yes'],
"lang_no" => $lang['no'],
"user_gender" => $user_gender,
Open: templates/default/member_editprofile.html
Find:
<tr>
<td class="row1"><b>{lang_invisible}</b></td>
<td class="row1"> <input type="radio" name="user_invisible" value="1"{user_invisible_yes} />
{lang_yes} <input type="radio" name="user_invisible" value="0"{user_invisible_no} />
{lang_no} </td>
</tr>
Below add:
<tr>
<td class="row2"><b>Gender</b></td>
<td class="row2">{user_gender}</td>
</tr>
Open: templates/default/member_profile
Find:
<img src="templates/default/images/{user_sex}.gif">
Remove it.
Find:
<tr>
<td class="row2"><b>{lang_icq}</b></td>
<td class="row2">{if user_icq}<a href="http://wwp.icq.com/scripts/search.dll?to={user_icq}">{user_icq}</a>
(<b>{user_icq_status}</b>){endif user_icq}</td>
</tr>
Below add:
<tr>
<td class="row1"><b>Gender</b></td>
<td class="row1">{user_gender}</td>
</tr>
Thats about it I think, Save and close the files. I have tested on a fresh install of 4images and it works great.
Please inform me of any problems.
Carl
-
@uksoreeyes:
first off, u shouldnt delete $additional_user_fields['user_sex'] = array($lang['user_sex'], "radio", 1);
simply change it to$additional_user_fields['user_sex'] = array($lang['user_sex'], "text", 0);
this way, u'll have an option in ACP when u edit or create new user.
also, if u use values as 1 = male, 2 = female and 3 = none then u'll save some headache and instead of:// User Gender Switch
if($user_row['user_sex'] == 1){
$user_gender = "Male <img src=\"templates/default/images/m.gif\">";
} else if($user_row['user_sex'] == 2){
$user_gender = "Female <img src=\"templates/default/images/w.gif\">";
} else {
$user_gender = "None Specified";
}
u could use:// User Gender Switch
$gender_array = array("Male", "Female", "None Specified");
$user_gender = $gender_array[$user_row['user_sex']]." <img src=\"".TEMPLATE_PATH."/images/gender".$user_row['user_sex'].".gif\">";
for that u must rename images to gender0.gif = male gender1.gif = female and gender3.gif = blank (nothing)
-
// User Gender Switch
$gender_array = array("Male", "Female", "None Specified");
$user_gender = $gender_array[$user_row['user_sex']]." <img src=\"".TEMPLATE_PATH."/images/gender".$user_row['user_sex'].".gif\">";
I like how you done that V@no. could we do something like that with:
// User Gender Switch
if($user_info['user_sex'] == 1){
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\" checked />
male
<input type=\"radio\" name=\"user_gender\" value=\"2\" />
female</font>";
} else if($user_info['user_sex'] == 2){
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\"/>
male
<input type=\"radio\" name=\"user_gender\" value=\"2\" checked />
female</font>";
} else {
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\"/>
male
<input type=\"radio\" name=\"user_gender\" value=\"2\"/>
female</font>";
}
That seems like such a lot of code for such a simple task and would like it if it could be simplified like the code you done above.
Carl
-
here is a code I use at my site:
$i = 0;
$gender = "";
$user_gender_select = array("none", "Male", "Female", "Both");
foreach ($user_gender_select as $key) {
$gender .= "<option value=\"".$i."\"".(($user_info['user_gender'] == $i) ? " selected" : "").">".$key."</option>\n";
$i++;
}
this will store dropdown options in $gender variable.
u may need change the array too.
-
I got this error
Warning: Invalid argument supplied for foreach()
-
are u sure? its working for me. just tryed on test file.
-
It may have something to do with other code I'm using within my new profile.php file. The code could be conflicting with the user age display and the user zodiacs I have added. Just so you know, its the User Sexuality I'm working with (at the bottom)
if ($action == "editprofile") {
if ($user_info['user_level'] == GUEST) {
show_error_page($lang['no_permission_updateprofile']);
exit;
}
// User Gender Switch
$gender_array = array("", "Male", "Female");
$user_gender = $gender_array[$user_info['user_gender']]."";
// User Age Display
$this_year=create_date('Y', time(), $board_config['board_timezone']);
$this_date = create_date('md', time(), $board_config['board_timezone']);
if ( $user_info['user_birthday'] != 999999 )
{
$poster_birthdate=realdate('md', $user_info['user_birthday']);
$n=0;
while ($n<26)
{
if ($poster_birthdate>=$zodiacdates[$n] & $poster_birthdate<=$zodiacdates[$n+1])
{
$zodiac = $lang[$zodiacs[($n/2)]];
$u_zodiac = $images[$zodiacs[($n/2)]];
$zodiac_img = '<img src="'.$u_zodiac.'" alt="'.$zodiac.'" title="'.$zodiac.'" border="0"/>';
$n=26;
} else
{
$n=$n+2;
}
}
$poster_age = $this_year - realdate ('Y',$user_info['user_birthday']);
if ($this_date < $poster_birthdate) $poster_age--;
$poster_age = '' . $poster_age .'';
} else
{
$poster_age = '';
}
// User Star Sign Display
if ($user_info['user_birthday']!=999999)
{
$poster_birthdate=realdate('md', $user_info['user_birthday']);
$i=0;
while ($i<26)
{
if ($poster_birthdate>=$zodiacdates[$n] & $poster_birthdate<=$zodiacdates[$i+1])
{
$zodiac = $lang[$zodiacs[($i/2)]];
$u_zodiac = $images[$zodiacs[($i/2)]];
$zodiac_img = $lang['Zodiac'].': <img src="'.$u_zodiac.'" alt="'.$zodiac.'" title="'.$zodiac.'" border="0"/>';
$i=26;
} else
{
$i=$i+2;
}
}
}
// User Sexuality Switch
$i = 0;
$sexuality = "";
$user_sexuality_select = array("", "Straight", "Bisexual", "Open Minded", "Gay / Lesbian");
foreach ($user_gender_select as $key) {
$sexuality .= "<option value=\"".$i."\"".(($user_info['user_sexuality'] == $i) ? " selected" : "").">".$key."</option>\n";
$i++;
}
Any ideas?
-
u forgot change variable name in foreach():
$user_sexuality_select = array("", "Straight", "Bisexual", "Open Minded", "Gay / Lesbian");
foreach ($user_gender_select as $key) {
-
haha I know, I just noticed and was about to delete the post, but it said 'you can't delete a post that has been replied to'
Thanks v@no
-
that's right, because as I said it will make only options (<option>) and u need insert it in <select> form.
this is what I have: <select name="user_gender" class="setperpageselect" />
{user_gender_options}
</select>
-
Yep got it now lol, I'm just not thinking straight today. Thats two simple mistakes I've made, maybe I should goto bed. :lol:
-
Hi!
Okay...my question is this...if we set the user to default as "male" is there a way for them to change it?
There is but it's going to require a few changes to the original mod.
First open: includes/db_field_definitions.php
Find:
$additional_user_fields['user_sex'] = array($lang['user_sex'], "radio", 1);
Remove it.
Open: member.php
Find:
else {
$user_icq_button = REPLACE_EMPTY;
}
Below add:
// User Gender Switch
if($user_row['user_sex'] == 1){
$user_gender = "Male <img src=\"templates/default/images/m.gif\">";
} else if($user_row['user_sex'] == 2){
$user_gender = "Female <img src=\"templates/default/images/w.gif\">";
} else {
$user_gender = "None Specified";
}
Find:
"lang_email" => $lang['email'],
"lang_homepage" => $lang['homepage'],
"lang_icq" => $lang['icq']
Change to:
"lang_email" => $lang['email'],
"lang_homepage" => $lang['homepage'],
"lang_icq" => $lang['icq'],
"user_gender" => $user_gender,
Find:
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'
Change to:
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq', user_sex = $user_gender
Find:
if ($config['account_activation'] == 2 && $user_info['user_level'] != ADMIN) {
$edit_profile_msg .= $lang['edit_profile_email_msg_admin'];
}
Below add:
// User Gender Switch
if($user_info['user_sex'] == 1){
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\" checked />
male
<input type=\"radio\" name=\"user_gender\" value=\"2\" />
female</font>";
} else if($user_info['user_sex'] == 2){
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\"/>
male
<input type=\"radio\" name=\"user_gender\" value=\"2\" checked />
female</font>";
} else {
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\"/>
male
<input type=\"radio\" name=\"user_gender\" value=\"2\"/>
female</font>";
}
Find:
"lang_edit_profile_msg" => $edit_profile_msg,
"lang_yes" => $lang['yes'],
"lang_no" => $lang['no']
Replace with:
"lang_edit_profile_msg" => $edit_profile_msg,
"lang_yes" => $lang['yes'],
"lang_no" => $lang['no'],
"user_gender" => $user_gender,
Open: templates/default/member_editprofile.html
Find:
<tr>
<td class="row1"><b>{lang_invisible}</b></td>
<td class="row1"> <input type="radio" name="user_invisible" value="1"{user_invisible_yes} />
{lang_yes} <input type="radio" name="user_invisible" value="0"{user_invisible_no} />
{lang_no} </td>
</tr>
Below add:
<tr>
<td class="row2"><b>Gender</b></td>
<td class="row2">{user_gender}</td>
</tr>
Open: templates/default/member_profile
Find:
<img src="templates/default/images/{user_sex}.gif">
Remove it.
Find:
<tr>
<td class="row2"><b>{lang_icq}</b></td>
<td class="row2">{if user_icq}<a href="http://wwp.icq.com/scripts/search.dll?to={user_icq}">{user_icq}</a>
(<b>{user_icq_status}</b>){endif user_icq}</td>
</tr>
Below add:
<tr>
<td class="row1"><b>Gender</b></td>
<td class="row1">{user_gender}</td>
</tr>
Thats about it I think, Save and close the files. I have tested on a fresh install of 4images and it works great.
Please inform me of any problems.
Carl
okay...i did that...and now i get this:
DB Error: Bad SQL Query: UPDATE 4images_users SET user_email = 'spoiledRHOtten@hotmail.com', user_showemail = 1, user_allowemails = 1, user_invisible = 0, user_homepage = '', user_icq = '', user_sex = 2', user_cat_active = '1', user_pms_email = '1', user_pms_popup = '0', user_org = '', user_avatar = 'users/1.jpg', user_club = '', user_chapter = '' WHERE user_id = 1
You have an error in your SQL syntax near '', user_cat_active = '1', user_pms_email = '1', user_pms_popup = '0', user_org =' at line 2
please help!
-
can i please send my member.php file to one of you? @V@no and uk?
help would be greatly appreciated.
-
u missed one single quote:
DB Error: Bad SQL Query: UPDATE 4images_users SET user_email = 'spoiledRHOtten@hotmail.com', user_showemail = 1, user_allowemails = 1, user_invisible = 0, user_homepage = '', user_icq = '', user_sex = '2', user_cat_active = '1', user_pms_email = '1', user_pms_popup = '0', user_org = '', user_avatar = 'users/1.jpg', user_club = '', user_chapter = '' WHERE user_id = 1
You have an error in your SQL syntax near '', user_cat_active = '1', user_pms_email = '1', user_pms_popup = '0', user_org =' at line 2
-
okay...where should I add it?
-
okay...where should I add it?
user_sex = '$user_gender
-
okay...where should I add it?
user_sex = '$user_gender
okay...now that i've done this...i think i'm back where i started with not being able to edit things in editprofile.html
because in editprofile.html...it allows for us to seeeee the sex...but not choose the sex now.
-
I have updated my original post with the changes v@no suggested. I then done a fresh install of 4images, installed the original mod made by brandkanne. I then installed my mod, as it is now and everything seems to work fine. Check through your code and make sure everything matches my post.
-
hat somebody gender-gif pics for me??
:D :D
-
yes somebody "hat" ;)
(http://photo.overlord.cz/templates/default/images/m.gif)
(http://photo.overlord.cz/templates/default/images/w.gif)
and the most important:
(http://photo.overlord.cz/templates/default/images/b.gif)
(http://photo.overlord.cz/templates/blue_wonder/smiles/big_smile.gif)
-
hmmmm... can somebody write a new MOD? this tread is very difficuld to understand. :-(
how is the name of the gender-gif´s???????
b.o.fan
-
come on! The mod is not so hard to implement!
the names of the gender gif are:
m.gif like man for the male sign
w.gif like woman for the female sign
and if you did use the third option then
b.gif like bisex for the hermafrodit sign ;)
-
Step 1a!
At first setup, you must edit for each existing user the user_sex field by hand with m or w
i hope your database is not so huge Embarassed (m=male, w=female)
I have 1873 users and i don undestand what i have to do by hand :S is there anyother way?
-
I have 1873 users and i don undestand what i have to do by hand :S is there anyother way?
would be nice if u read replys atleast on the first page...
-
I have read them all before post but i don understand this At first setup, you must edit for each existing user the user_sex field by hand with m or w
i hope your database is not so huge Embarassed (m=male, w=female)
-
there is a sollution on first page! I wouldnt say that if there wasnt any...
-
actualy when u are adding new field, just make default ('m')
if u already added that field, run this query to update all enteries:
Code:
UPDATE 4images_users SET user_sex = 'm'
If this is the solution I don't understand this ... what I have to do please tell me. it working with the new user but not with de register before the instalation of the MOD I see a broken image
-
go to phpmyadmin, select the right db if you have more, open the query-window, paste UPDATE 4images_users SET user_sex = 'm' into the query field
and push "Submit query" that's all ;)
-
Thank you so much! Matrix
-
I don't find this on my memerlist.php
$userlist .= "<td valign=\"top\" align=\"left\">".$session_ip." ".$user_name."</td>\n";
I put it in below this:
$userlist .= "<td valign=\"top\" align=\"center\">".$total_user_images_link."</td>";
and when I go to see my member list I see a broken link image
-
what link image?
-
did u went to my pege to see it ? I change it sorry I will put it again now
-
Thank you so much! Martrix
You're welcome
You don't have to add a new line, just add $user_sex right next to the name... or on any other place you wish - so you have to search for a line beginning
with $userlist containing the string $user_name. and replace that with $user_name." ".$user_sex. in the memberlist.php
when I go to see my member list I see a broken link image
and when you check the image-properties of that "broken image"?
What path is there? Did you save the m.gif w.gif (or also b.gif) @ the right place? (sorry, but you do not allow right-clicks, so I could not check it by myself...)
-
the path is templates/default/images/m.gif but my template is call blue where can I change the path?
I put the Images there and it does work :)
I just dont get one thing . in the editmember_profile.htm the {user_gender} does not show up :( so the old user cannot change their gander
when I put a user as a female I also get a broken image and the path is this templates/blue/images/.gif :S
-
I have test this Mod but it doesn´t work.
It´s very difficuld to understand all the topics.
a new install where very good....
-
hm... if even such a dumb*** like me was able to follow the steps Jens, then you will be surely able to manage that too...
Just try to check if you did follow the steps as written - last time I was asked how help with this mod it came out, that one important step was missed...
-
Hmmmm... I did follow all steps.. two times now, but it is not working correctly. (when including the second part of the mod to enamble users to edit their gender settings)
I don't know much about php, but somehow the code gets confused with one part of it still using m,f,g as the values, while the other part uses numbers as the values to store in the DB for determing the users gender...
Can someone please rewrite this to one clean mod?
-
how the user gender show in image comments (before username )
{user_sex} username ???
-
Hum, I think it's the first time I post on this topic.
However, I found two unusual paths :
$user_sex = "<img src=\"templates/default/images/".htmlspecialchars($user_row['user_sex']).".gif\">".$var_name." ";
as a generic case, it should be like :
$user_sex = "<img src=\"".get_gallery_image(htmlspecialchars($user_row['user_sex'])).".gif\">".$var_name." ";
;)
There's also another "default" path pointed from above the first post on this topic (as well)
which is this one :
<img src="templates/default/images/{user_sex}.gif">
let's modify this line a little bit.
In your member.php file,
find :
if ($config['account_activation'] == 2 && $user_info['user_level'] != ADMIN) {
$edit_profile_msg .= $lang['edit_profile_email_msg_admin'];
}
$site_template->register_vars(array(
"user_name" => htmlspecialchars(stripslashes($user_name)),
add "right" below :
"user_sex_image" = get_gallery_image(htmlspecialchars($user_row['user_sex'])).".gif;
Then, replace the original line from your member_profile.html file
with this one :
{if user_sex_image}<img src="{user_sex_image}">{endif user_sex_image}
Now, you can use this tag with "all your templates" rather than just the default template. ;)
-
but i mean for image comments, not for member profile .... :roll:
-
Did you tried with : {user_gender} ? ;)
-
yes i've :)
my doubts its about this is just about member.php and member_profile , for comments maybe details.php and comment_bit ???
:?:
-
There's also another "default" path pointed from above the first post on this topic (as well)
You're doing a good job "ironing out" the paths in mods,
but remember, that some graphics are the same on different templates - therefore I have
all flags/gender signs etc. stored in the "default" template, no matter what
template is set actually...
-
moved/
So, today a user of my site asked me about that, and i think too that this would be a good idea (when you have 20+ users online at the same time)
That would work of course just if user GIS mod is installed: Female usernames shown in red and male names in blue, so the orientation would be much better.
what do you think about that?
greetings
georgi
-
Lets see, asuming your have the default code for "whos online" section in includes/sessions.php. Then find:
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible")."
At the end of that line add:, u.user_sex
The end result should be:[qcode] $sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible").", u.user_sex[/qcode]
Then find: $user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
Replace with: $user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\" class=\"wosex".$row['user_sex']."\">".$username."</a>".$invisibleuser;
Then in style.css stylesheet add three new classes with needed coolors and such:
.wosex { /*no sex*/
}
.wosexm { /* male */
color: red;
}
.wosexw { /* female */
color: blue;
}
In some cases because the stylesheed for links could override this style, you'll need use this type of naming instead:
.wosex:visited, .wosex:link, .wosex:active
-
thanks for that addon, but when i make the changes, i have displayed 0 users and 0 guests online instead of th real number.
I have the countryflags mod installed, can there be the problem?
georgi
-
I have the countryflags mod installed, can there be the problem?
Most probably.
-
o no, the problem was becaus the table is user_gender instead of user_sex , so now i have no errors, but also no colors. Stays always the same gray :?
-
Hi
i have 2 problems.
1.) I Have installed this mini MOD but if i go to the member_profile site. i see a mini black field with white border but not the images sex.
Here is a screen.
(http://funchecks.fu.funpic.de/profil1.JPG)
2.) In ACP I see only Ja / Nein (Yes / Not) for the gender and not weiblich / männlich (female / male)
How can i change this 2 problems ? I use 4images 1.7.2.
Here are the code that i have fill in the files.
db_field_definitions.php
$additional_user_fields['sex'] = array($lang['sex'], "radio", 1);
register_form.html
<tr>
<td class="row2"><b>{lang_sex}</b></td>
<td class="row2" width="20"><input type="radio" name="sex" value="m" checked />männlich
<input type="radio" name="sex" value="w" />weiblich</td>
</tr>
member_profile.html
<tr>
<td class="row2"><nobr><b>{lang_sex}</b></nobr></td>
<td class="row2"><img src="templates/default/images/{sex}.gif" width="14">
</td>
</tr>
Here is a image of my databse entry,too but i think that is correct.
(http://funchecks.fu.funpic.de/db.JPG)
-
1.) I Have installed this mini MOD but if i go to the member_profile site. i see a mini black field with white border but not the images sex.
Did you set the gender-entry in the MySQL database for "Marcel W" and all other users?
If not, see here (http://www.4homepages.de/forum/index.php?topic=6000.msg26124#msg26124), how to do that.
Check also the path to the "broken" image - if it isn't coded to a inexisting file or if it isnt just smt like ".../.gif"
-
Did you set the gender-entry in the MySQL database for "Marcel W" and all other users?
If not, see here, how to do that.
Check also the path to the "broken" image - if it isn't coded to a inexisting file or if it isnt just smt like ".../.gif"
Hey that reply help me but it show only male symbols and if i got to the admin area, search for users when stand there:
gender : yes no x
(x mean that is checked)
When i click on yes i have the same problem how in the past. When i click in no after i click on yes i have the problem,too. Only if i make the step how V@no describe on a other post it will be go.
What is the problem ? And why stand in the ACP yes / no and not male / female ?
-
Hi all again.
//// ENGLISH \\\\
I have my problem every,too. Please Help me. I try so much but it dont will be work. I try to explain again.
First when i make a new additinonal field i cant make user_xxxx. It dont will be work. So i try onlly xxxx and it will work. that is not the problem i think, but now. When i register a user and will check m i think it will go, but when i check w (female) the script write in the database 0 and no image will be show in the member_profile. I have make the Update at first,too. So when i try to make the value in the radio buttons (in teh register page) to set 0 for w and 1 for m. But it dont will be go. Another little problem is that in the ACP it will be show Yes or Not and NOT Male / Female. Please Help me. I use version 1.7.2.
//// DEUTSCH \\\\
Hallo ich versuche nochmal mein Problem zu beschreiben. Als erstes Problem habe ich das ich nicht in einem additional field the table prefix user_sex machen kann sondern nur sex. ( $additional_user_fields['sex'] = array($lang['sex'], "radio", 1); ). Das ist nicht das Problem, da es bei den anderen Feldern auch so funktioniert hat ohne dem user_. Nun zum eigentlichen Problem. When ich einen neunen User registriere und auf männlich klicke zeigt er meistens das männliche Symbol richtig an. Kllicke ich nun aber auf weiblich speichert er in der DB eine 0 und zeigt nur ein kleines Kästchen an. Nun dachte ich änder ich einfach den value wert in der register_form page statt für männlich value="m" habe ich value="1" und für weiblich value="0" geschrieben. Ging aber auch nicht. Habe auch die Bilder 0 udn 1 genannt. Ging alles nicht. Langsam weiß ich echt nicht merh weiter. Desweiteren (das kleinste Problem) wird im ACP nir unter Usereinstellungen männlich / weiblich angezeigt sondern nur Ja / Nein. Hat irgendjemand eine Idee woran das lieg? Hatte jemand auch diese Problem ? Bitte helft mir ! Ich benutze Version 1.7.2
-
im ACP sollte eigentlich nich "ja/nein" stehen, sondern männlich weiblich... oder besser nur der text m/w(/b falls hermafroditen erlaubt sin ;) )
- Ist in der DB der das feld auch richtig eingestellt (also für texteinträge)?
- Hast du überall im code "user_sex" durch "sex" ersetzt (also db_field_definitions, register_form, usw)?
-
Hallo matrix
Sorry war bis heute im Krankenhaus und konnte nicht antworten. Ja in der DB ist alles swoeit richtig eingestellt und ich habe auch alles auf "sex" geändert. Könntest du dir das eventuell anschauen und mir bei diesem Problem helfen ?
Wäre echt nett ;)
-
Hi,
I have Installed the Mod. When I put in Database manuell m or w all works fine.
Butt when I make a new user, the mod set auto the user_sex field with"0". Not "m" or "w".
Can anybody help me?
----------------------
Hallo,
Habe gerade den Mod installiert. Funktionier soweit alles bestens. Wenn ich in der Datenbank selbst "m" oder "w" beim user eingebe, wird alles perfekt angezeigt.
Sobal ich mich aber neu anmelde auf meiner Seite, also ein neuer User erstellt wird, setzt er in der Datenbank das Feld user_sex auf "0" und das gibs ja nciht!
warum ???
-
Thanks! This mod is too great!!
In your member.php file,
find :
if ($config['account_activation'] == 2 && $user_info['user_level'] != ADMIN) {
$edit_profile_msg .= $lang['edit_profile_email_msg_admin'];
}
$site_template->register_vars(array(
"user_name" => htmlspecialchars(stripslashes($user_name)),
add "right" below :
"user_sex_image" = get_gallery_image(htmlspecialchars($user_row['user_sex'])).".gif;
Then, replace the original line from your member_profile.html file
with this one :
{if user_sex_image}<img src="{user_sex_image}">{endif user_sex_image}
Now, you can use this tag with "all your templates" rather than just the default template. ;)
If i do this changes my memberprofile have an error, i see all it in white colour.. I think that it is because I have in my member.php the next code :
$site_template->register_vars(array(
"user_name" => format_text(stripslashes($user_name), 2),
and not the next that i can to find..
"user_name" => htmlspecialchars(stripslashes($user_name)),
maybe i could add below something like the next code??? I don't know php so please help me :(
"user_sex_image" = get_gallery_image(format_text(stripslashes($user_row['user_sex'], 2).".gif;),
-
At me a problem, has made all as was написанно in the instruction, but alas does not work.
I have version 1.7.1.
Here what mistake{error} turns out
DB Error: Bad SQL Query: UPDATE 4images_users SET user_email = ' konkor2001@mail.ru ', user_showemail = 1, user_allowemails = 1, user_invisible = 0, user_homepage = ' http://my-mobiles.net ', user_icq = ' 76833206 ', = ' 2 ', birthday = ' 2006-02-22 ', user_pm_email = ' 1 ', user_pm_popup = ' 1 ' WHERE user_id = 995
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' = ' 2 ', birthday = ' 2006-02-22 ', user_pm_email = ' 1 ', user_pm_popup = ' 1 ' ' at line 2
Whether correctly I have written this line
$sql = "UPDATE" .USERS_TABLE. "
SET " .get_user_table_field (" "," user_email "). " = ' $user_email ', " .get_user_table_field (" "," user_showemail "). " = $user_showemail, " .get_user_table_field (" "," user_allowemails "). " = $user_allowemails, " .get_user_table_field (" "," user_invisible "). " = $user_invisible, " .get_user_table_field (" "," user_homepage "). " = ' $user_homepage ', " .get_user_table_field (" "," user_icq "). " = ' $user_icq ', " .get_user_table_field (" "," user_sex "). " = ' $user_gender ' ". $additional_sql. "
-
Könnte man die Änderungserweiterung nochmal so zusammenfassen, das nicht jeden dritten Post eine besser Version aufgezeigt wird...
wollte das nämlich einbauen und nicht 15 mal jede Dati editieren, weil drei posts später eine kürzere Version kommt...
desweiteren wäre eventl hilfreich in welchen Dateien die Änderungen zu erfolgen haben... hiervon steht nämlich nichts dabei
grüsse
-
Hi !!
I am a newbie to 4images but can still understand your MOD for user gender.
I appreciate your MOD ...
But I am stuck up at this point:
"But if you use MOD Memberlist, try this too:"
Can you please tell me what this means and where should I find the Code next to this?
I wanted to see the Gender of the users in the Admin Control Panel as well, which is not visible after completion of the steps till this point. So I think I need to carry out some more steps.
Please help me out on this , I would be highly thankful to you :)
Sidharth
-
Post updated on: 19 June 2003, 03:21amHi!
Okay...my question is this...if we set the user to default as "male" is there a way for them to change it?
There is but it's going to require a few changes to the original mod.
First open: includes/db_field_definitions.php
Find:
$additional_user_fields['user_sex'] = array($lang['user_sex'], "radio", 1);
Change to:
$additional_user_fields['user_sex'] = array($lang['user_sex'], "text", 0);
Open: member.php
Find:
else {
$user_icq_button = REPLACE_EMPTY;
}
Below add:
// User Gender Switch
$gender_array = array("Male", "Female", "None Specified");
$user_gender = $gender_array[$user_row['user_sex']]." <img src=\"".TEMPLATE_PATH."/images/gender".$user_row['user_sex'].".gif\">";
Rename images to gender0.gif = male gender1.gif = female and gender3.gif = blank (nothing)
Find:
"lang_email" => $lang['email'],
"lang_homepage" => $lang['homepage'],
"lang_icq" => $lang['icq']
Change to:
"lang_email" => $lang['email'],
"lang_homepage" => $lang['homepage'],
"lang_icq" => $lang['icq'],
"user_gender" => $user_gender,
Find:
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'
Change to:
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq', user_sex = '$user_gender'
Find:
if ($config['account_activation'] == 2 && $user_info['user_level'] != ADMIN) {
$edit_profile_msg .= $lang['edit_profile_email_msg_admin'];
}
Below add:
// User Gender Switch
if($user_info['user_sex'] == 1){
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\" checked />
male
<input type=\"radio\" name=\"user_gender\" value=\"2\" />
female</font>";
} else if($user_info['user_sex'] == 2){
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\"/>
male
<input type=\"radio\" name=\"user_gender\" value=\"2\" checked />
female</font>";
} else {
$user_gender = "<input type=\"radio\" name=\"user_gender\" value=\"1\"/>
male
<input type=\"radio\" name=\"user_gender\" value=\"2\"/>
female</font>";
}
Find:
"lang_edit_profile_msg" => $edit_profile_msg,
"lang_yes" => $lang['yes'],
"lang_no" => $lang['no']
Replace with:
"lang_edit_profile_msg" => $edit_profile_msg,
"lang_yes" => $lang['yes'],
"lang_no" => $lang['no'],
"user_gender" => $user_gender,
Open: templates/default/member_editprofile.html
Find:
<tr>
<td class="row1"><b>{lang_invisible}</b></td>
<td class="row1"> <input type="radio" name="user_invisible" value="1"{user_invisible_yes} />
{lang_yes} <input type="radio" name="user_invisible" value="0"{user_invisible_no} />
{lang_no} </td>
</tr>
Below add:
<tr>
<td class="row2"><b>Gender</b></td>
<td class="row2">{user_gender}</td>
</tr>
Open: templates/default/member_profile
Find:
<img src="templates/default/images/{user_sex}.gif">
Remove it.
Find:
<tr>
<td class="row2"><b>{lang_icq}</b></td>
<td class="row2">{if user_icq}<a href="http://wwp.icq.com/scripts/search.dll?to={user_icq}">{user_icq}</a>
(<b>{user_icq_status}</b>){endif user_icq}</td>
</tr>
Below add:
<tr>
<td class="row1"><b>Gender</b></td>
<td class="row1">{user_gender}</td>
</tr>
Thats about it I think, Save and close the files. I have tested on a fresh install of 4images and it works great.
Please inform me of any problems.
Carl
Please help I have completed all the instructions succesfully but the ACP still shows Yes and No instead of Male, Female, Both