Plugin Author
donmik
(@atallos)
Hi,
The correct way is the second way but I believe you have no output because you made a mistake
Date if birth instead of Date of birth
The correct code:
xprofile_get_field_data( 'Date of birth', $user_id );
You can read more about this in the next thread.
Hi,
Thanks for your reply.
Sorry I made a spelling mistake in the post, but not in the code I used. I still don’t get any output.
I’ve put the following code in my Child Theme > Members > members-loop.php
From line 57: `
<?php do_action( ‘bp_directory_members_item’ ); ?>
<?php
/***
* If you want to show specific profile fields here you can,
* but it’ll add an extra query for each member in the loop
* (only one regardless of the number of fields you show):
*
* bp_member_profile_data( ‘field=the field name’ );
*/
xprofile_get_field_data( ‘Date of birth’, $user_id );
?>
</div>`
I really can’t figure out what I am doing wrong…
Plugin Author
donmik
(@atallos)
Have you assigned a value to $user_id ?
No I haven’t, would I need to?
Plugin Author
donmik
(@atallos)
$user_id need to have the id of the user. If you send a null value, the function can’t display anything.
If you use the function “bp_member_user_id()” instead of $user_id, I think it should work.
I’m afraid I still don’t get any output using the above function…
Plugin Author
donmik
(@atallos)
Sorry it’s not bp_member_user_id() but bp_get_member_user_id().
I write this in my members-loop.php:
echo xprofile_get_field_data('Date of Birth', bp_get_member_user_id());
And all works as expected…
Thanks, I got it working too!
One more thing:
How would I include the label ‘Age’ to this output?
Plugin Author
donmik
(@atallos)
echo 'Age: '. xprofile_get_field_data('Date of Birth', bp_get_member_user_id());
Something like this?
Hi
I really appreciate your support. To show the fields I am now using the BuddyProfileData plugin. Unfortunately it again shows ‘Date of Birth’ instead of ‘Age’ in the loop. For some reason only with this profile field it creates a lot of white space below.
Would you be willing to have a look at my issue?
Is there a way I can send you a link to my site in private?
Again,
Thank you!
Plugin Author
donmik
(@atallos)
Of course, if I can help you. Send me an email at miguel@donmik.com.