sara.vandeste
Member
Posted 2 months ago #
Hi,
I have the birthday field set to "show age". Age is correctly displayed on users profile but not on members directory (showing birthday date insted).
I'm using <?php bp_member_profile_data( 'field=Age' );?> to call the age field.
How can I display it correctly?
Thanks for your help!
http://wordpress.org/extend/plugins/buddypress-xprofile-custom-fields-type/
Hi,
You need to create a function to calculate your age you can use my plugin for example. Put this code in the functions.php in your theme:
function echo_age($birthdate) {
echo floor((time() - strtotime($birthdate))/31556926);
}
Now instead of using this
<?php bp_member_profile_data( 'field=Age' );?>
Use this:
`<?php echo_age(bp_get_member_profile_data('field=Age')); ?>
And it will work I think.
sara.vandeste
Member
Posted 2 months ago #
Hi!
It's not working perfectly!
Thank you so much for your help! ;)
evo252
Member
Posted 2 months ago #
Thousand thanks for this tip Atallos, and for your very very useful plugin!