• Resolved yessoftmk

    (@yessoftmk)


    Hey. Thanks for plugin.

    I can get some field:

    
    $retval = xprofile_get_field_data( 'Phone',  get_post_field( 'post_author', $post_id )  );
    echo 'tel:' . $retval ;
    

    And how I can get value indicating visibility of the “Phone” field?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Brajesh Singh

    (@sbrajesh)

    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

    Plugin Author Brajesh Singh

    (@sbrajesh)

    Marking it resolved. Please feel free to reopen if you need any further assistance.

    Regards
    Brajesh

    Thread Starter yessoftmk

    (@yessoftmk)

    thanks, work

    Plugin Author Brajesh Singh

    (@sbrajesh)

    You are welcome ??

    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 5 years, 3 months ago by Ramakrishnan.
    • This reply was modified 5 years, 3 months ago by Ramakrishnan.
    Plugin Author Brajesh Singh

    (@sbrajesh)

    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

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Get visibility value’ is closed to new replies.