BuddyDev

Search

Cannot retrieve xprofile field data

Tagged: 


  • Participant
    Level: Initiated
    Posts: 1
    medievil on #21536

    Hi,

    I have a strange issue that I cannot figure out.
    I have created a new profile field and I am using the following function to try retrieve the data:

    $phonecheck = xprofile_get_field_data('Show your phone number in website search results?', $bpmember);

    This code is identical to other xprofile fields in the same file and they are retrieving the data fine.
    The only difference is that this particular xprofile field is new, the others were created about 12 months ago.
    I have tried downgrading the plugin to the last couple of versions but to no success.

    Is there some new way to get the xprofile field data that I am not aware of?


  • Keymaster
    Level: Guru
    (BuddyDev Team)
    Posts: 600
    Ravi on #21539

    Hello Medievil,

    Thank you for posting. Please let me know what is the type of this field is. Because if it is a checkbox
    field and user has not selected any of its options then it will give empty string. Also make sure $bpmember is not empty. You can use php function “var_dump” to check what result function is returns

    Thank You
    Ravi


  • Participant
    Level: Initiated
    Posts: 1
    medievil on #21544

    Hi Ravi,

    Thanks for reaching out.
    The field type is a Dropdown Select with two options (Yes & No).

    A var_dump of $bpmember returns the correct integer for that particular member.
    A var_dump of $phonecheck returns a blank string.

    I have an identical function ($emailcheck) that grabs field data from an identical Dropdown Select field and this is returning “Yes” as normal.

    I am at a complete loss as to why this is occurring. I have checked the syntax 10 times and it is identical to a working function.
    It only appears to be happening to newly created xprofile fields, I cannot fetch data from any of them. However I can grab data from the older fields with no problems.


  • Keymaster
    (BuddyDev Team)
    Posts: 10520
    Brajesh Singh on #21545

    Hi,
    Can you please visit the profile of the specific user(You are passing as the second parameter) and confirm that on view profile the data is being shown for new fields?

    The possible reasons are:-
    1. Either data is not set for the given user for the new fields.
    2. Or the Field name is not being parsed to field id. Try using Field id(numeric value in place of field name).

    Let me know what you find.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved
Subscribe