Skip to:
Content
Pages
Categories
Search
Top
Bottom

edit and save custom profile fields with swapped values

  • Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    I need to do a Between search on a Height profile field.
    But the admin profile field setup doesn’t allow for a difference between option value and displayed option.

    So you get:
    `under 5′ – 152cm`

    What I need is:
    `under 5′ – 152cm`

    I can generate what I need by adding, to bp-custom :
    `add_filter( ‘bp_get_the_profile_field_options_select’, ‘profile_field_options_select_swap’, 10, 1 );`
    and using str_ireplace to swap the values.

    But if the user edits their profile on the Height selector, they get the error – “There was a problem updating some of your profile information, please try again.”

    Any hints on cause and fix for this error ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    Error caused by checking for ‘acceptable value’ before save.
    See
    /* Check the value is an acceptable value */
    around Line 735 in bp-xprofile.php

    I removed ‘selectbox’ from the ‘if’ and profile save now works.

    Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    Argh – much faster, coding and parsing-wise, to do this in members_single_profile/edit.php
    as opposed to doing an add_filter on ‘bp_get_the_profile_field_options_select

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.