ah and I forgot it how can I show it in the profil if a user is online?
This article shows you to calculate the age:
http://code.hyperspatial.com/all-code/buddypress-code/buddypress-age/
If you want to display the gender as an image, you can do it with a simple PHP if clause that checks your gender field and inserts the correct tag appropriately (or marks the field up with a class identifier), and style as a background image in your CSS.
I suggest posting your “check for online” query as a separate forum post, so that it doesn’t get overlooked
hello……whats the php code to show and image instrad of female or male in words??? thanks
I found this code but it doesnt work for me:
if ( bp_get_the_profile_field_name() == ‘Gender’ ) {
global $field;
$value = bp_unserialize_profile_field( $field->data->value );
$value = explode( “, “, $value);
if ( in_array( ‘Female’, $value ) )
echo ‘img src=”female.gif” /’;
if ( in_array( ‘Male’, $value ) )
echo ‘img src=”male.gif” /’;
}
I’m using checkboxes and I added this in memers-loop I want also to add it to profile loop
@RogerCoathup or @nickmy the age is also not working for me??? I want to show the gender and the age
after the nickname like: NICKNAME (18 years old / *Gender as image*)
@tubruk if you are having a problem using Adam at Hyperspatial’s functions for age (they look fine to me), then please leave a comment for him on his blog
The code you have for gender needs to be used inside a loop that’s iterating over fields, and have the correct profile fields and values set up for gender. You say you got the code from somewhere… Have you asked there about why it doesn’t work for you?
If you don’t get an answer on gender… Start a separate thread, but post a lot more information and code showing exactly how you are trying to use the code
@RogerCoathup okay thanks it works now. Now the gender is not working. It works when I use it in profile-loop.php but not in member_header just after the nick like nickname(gender/age) @nickname…