Hi,
You may use the function xprofile_get_field_visibility_level( $field_id = 0, $user_id = 0 ) like below.
$level = xprofile_get_field_visibility_level( xprofile_get_field_id_from_name('Phone' ), get_post_field( 'post_author', $post_id ) );
Regards
Brajesh
Marking it resolved. Please feel free to reopen if you need any further assistance.
Regards
Brajesh
Hi Brajesh Singh,
I’m using ‘echo xprofile_get_field_data’ inside a <li>
like below :
`<li><i class=”fas fa-birthday-cake” aria-hidden=”true”></i>
<span class=”<?php echo(xprofile_get_field_visibility_level( ‘Date of Birth’, $memberId)); ?>”><?php echo xprofile_get_field_data( ‘Date of Birth’, $memberId); ?></span></li>
<li><i class=”fas fa-link” aria-hidden=”true”></i>
<span><?php echo xprofile_get_field_data( “Gender”, $memberId); ?></span></li>
<li><i class=”fas fa-map-marker-alt” aria-hidden=”true”></i>
<span><?php echo xprofile_get_field_data( ‘My Location’, $memberId); ?></span></li>`
how to control visibility for the fields above?
i have tried below code but no luck, please help
<span class="<?php echo(xprofile_get_field_visibility_level( 'Date of Birth', $memberId)); ?>"><?php echo xprofile_get_field_data( 'Date of Birth', $memberId); ?></span>
Thanks in advance
-
This reply was modified 6 years, 6 months ago by
Ramakrishnan.
-
This reply was modified 6 years, 6 months ago by
Ramakrishnan.
Hi @egrovesys
BuddyPress does not apply the field visibility on individual field data. It only applies on the xprofile data loop.
The above code will not hide data and there is no direct way. you will need to handle the visibility part if using xprofile_get_field_data.
PS:- Please open a new topic in future as the replies on this topic may be notified to the original poster.
Regards
Brajesh
Thank you i have created a new topic on this here