Skip to:
Content
Pages
Categories
Search
Top
Bottom

xprofile show public fields


  • peacefulwarri0r
    Participant

    @peacefulwarri0r

    Hi,

    im a bit lost. I try to display all Profile Fields when the visibility level is public.
    The best would be to just display all of the social media group which are marked as public.

    But, I found no solution for receiving the name by id. So my solution at the moment works, but seems to be a bit static and complicated.

     $user_visibility_levels = bp_xprofile_get_fields_by_visibility_levels($post->post_author, 'public');
      $soc_instagram = xprofile_get_field_data('Instagram', $post->post_author);
      $id_instagram = xprofile_get_field_id_from_name('Instagram');
      $soc_website = xprofile_get_field_data('Webseite', $post->post_author); 
      $id_website = xprofile_get_field_id_from_name('Webseite');
    
       if(in_array($id_instagram, $user_visibility_levels)){
             echo "<td>Instagram</td><td>$soc_instagram</td>";
       }
       if(in_array($id_website, $user_visibility_levels)){
             echo "<td>Webseite</td><td>$soc_website</td>";
       }
    

    It would be a dream to receiving fieldname, fieldvalue of a user filtered by the level. Is there any way? Or how I can improve the code above?

    Thanks!

  • You must be logged in to reply to this topic.
Skip to toolbar