Skip to:
Content
Pages
Categories
Search
Top
Bottom

Getting profile fields data?


  • oguruma
    Participant

    @oguruma

    I have a profile field called “phone number”. I need a way to set that as a variable so I can send it with a curl call..

    Does anybody know the function to get profile field data?

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

  • shanebp
    Moderator

    @shanebp


    oguruma
    Participant

    @oguruma

    Thanks for the input. I was hoping to catch extended profile meta at time of registration, but it turns out that the insert_user_meta filter fires too soon…

    Do you know of a good way to capture extended profile meta at user registration? (assuming they entered it at registration, of course).

    `add_filter(‘insert_user_meta’,’send_user_data’,100,4);

    function send_user_data($meta,$user,$update,$userdata){
    $user_id = $userdata[‘ID’];
    $phone_number = strip_tags( xprofile_get_field_data ($user_id, ’11’,’string’) );

    $ch = curl_init();

    $user_payload = array (
    ‘id’ => $user_id,
    ‘phone’ => $phone_number,
    );

    curl_setopt($ch, CURLOPT_URL,”https://myurl.m.pipedream.net”);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $user_payload);

    // In real life you should use something like:
    // curl_setopt($ch, CURLOPT_POSTFIELDS,
    // http_build_query(array(‘postvar1’ => ‘value1’)));

    // Receive server response …
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $server_output = curl_exec($ch);

    curl_close ($ch);

    return $meta;
    return $user;
    return $update;
    return $userdata;

    };


    shanebp
    Moderator

    @shanebp

    Please use the code button when posting code here.
    Try: bp_signup_usermeta

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