Skip to:
Content
Pages
Categories
Search
Top
Bottom

Finding profile field id


  • navyspitfire
    Participant

    @navyspitfire

    I have the code below which prints out every field+value that a member has filled in. I am trying to only display select field+value fields, but my first attempt failed and I’m not sure how to reference the fields.

    First attempt (182, aka field_182):
    bp_get_the_profile_field_name(182)
    bp_get_the_profile_field_value(182)

    Code block:

    $this->tabs_instance->has_data[$name] = true;
    $this->tabs_instance->fields_data[$name] .= '<dt class="bp-field-name bp-field-id-' . bp_get_the_profile_field_id() . '">'. bp_get_the_profile_field_name().'</dt>';
    $this->tabs_instance->fields_data[$name] .= '<dd class="bp-field-value bp-field-id-' . bp_get_the_profile_field_id() . '">'. bp_get_the_profile_field_value().'</dd>';
Viewing 3 replies - 1 through 3 (of 3 total)

  • danbp
    Participant

    @danbp

    Hi,

    try this (replace industry by field name of 182)

    if ( $data = bp_get_profile_field_data( 'field=Industry' ) ) : 
    	echo '<div class="industry">'. xprofile_get_field_data( 'Industry', bp_displayed_user_id() ) .'</div>';
    endif;

    navyspitfire
    Participant

    @navyspitfire

    Thank you. However, this only returns the value. How would I return the field name/label associated with that value?

    Updated block:

    $this->tabs_instance->fields_data[$name] = '<dt class="bp-field-name bp-field-id-' . bp_get_the_profile_field_id() . '">'. bp_get_the_profile_field_name().'</dt>';
    $this->tabs_instance->fields_data[$name] = '<dd class="bp-field-value bp-field-id-' . bp_get_the_profile_field_id() . '">'. xprofile_get_field_data( 'Eye Color', bp_displayed_user_id() ) .'</dd>';

    navyspitfire
    Participant

    @navyspitfire

    Hi, any idea how I would return the field name/label?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar