• Resolved samkat4u

    (@samkat4u)


    Hi Ali,

    I am using this plugin for user registration, and it is working fine. Now i wanted to add few custom meta keys. I have tried it using update_user_meta function.

    Following is the flow i am using update_user_meta is:
    1. Generating nonce
    2. Registering user with basic parameters i.e username, first_name, email, display_name, user_url, user_pass and nonce.

    But in registration i need to send few more parameters like phone_number, user_address, user_website. For that i am using update_user_meta.

    3. Getting cookie from step 2, adding cookie to update_user_meta with meta_key and meta_value.

    In the response of step 3, i am getting response ‘provide username’. When i provide it, getting response ‘provide email’. When i provide both then getting ‘provide nonce’. When i provide all these then i am getting response ‘User already exist’.

    Can you suggest the solution on it. Kindly clarify me if my flow is incorrect.

    Thanks,
    SamKat

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ali Qureshi

    (@parorrey)

    in the step 3,

    You need to use update_user_meta endpoint, you are not registering user again so this error cannt possibly occur.

    you only have to provide cookie, that will identify user, meta_key and meta_value. that’s all.

    there is no other param required.

    Thread Starter samkat4u

    (@samkat4u)

    Hi Ali,
    Thanks for prompt response. In step 2 i am using api/user/register endpoint and in step 3 i am using api/user/update_user_meta. Following is my curl code:
    $ch1 = curl_init(); // Initiate cURL
    $url1 = $site_url.”api/user/update_user_meta/”; // Where you want to post data
    curl_setopt($ch1, CURLOPT_URL,$url);
    curl_setopt($ch1, CURLOPT_POST, true); // Tell cURL you want to post something

    curl_setopt($ch1, CURLOPT_POSTFIELDS, “cookie=”.$res_data->cookie.”&insecure=cool&meta_key=billing_phone&meta_value=”.$billing_phone);

    curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true); // Return the output in string format
    $output1 = curl_exec ($ch1); // Execute
    print_r($output1);
    curl_close ($ch1);

    I am getting cookie from step 2 response.

    Thread Starter samkat4u

    (@samkat4u)

    ohhh… Yeah… I found the error.

    curl_setopt($ch1, CURLOPT_URL,$url); in this line, i should have to use $url1.

    Thanks Ali, appreciating your efforts. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘adding new meta key values in update_user_meta’ is closed to new replies.