Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards

hoo or filter after vendor registration

MultivendorX Pro

Resolved
Viewing 12 reply threads
  • Author
    Posts
    • #193572
      matteor182
      Participant

      I have to store some form fields in custom fields created by me, which hook or filter allows me to take all the form data after it has been submitted and registered?

      including the id of the newly created user ?

      Thank you very much

    • #193595

      Hello @matteor182.
      Once a vendor registers on the site, his submitted details get already stored in the database.
      The details get saved in the user meta table.By the user id you can fetch the user details from the meta table.
      If you are looking for something else please explain that so that we can provide you with a hook/filter accordingly.

    • #193611
      matteor182
      Participant

      Hello,
      thanks for the answer,

      I need exactly the moment after sending the registration form immediately after the new user has been created, because I need the form data and the new user’s id.

      thank you very much

    • #193627

      You need to fetch the registration form data using this two functions :
      $vendor = get_mvx_vendor($user_id);
      $first_name = get_user_meta($vendor->id, ‘first_name’, true);

    • #193643
      matteor182
      Participant

      Hello Sangita,

      thanks for the answer,

      but when should I use these two functions? Isn’t there a hook that gets called when the user is created after the form is submitted?

      if I use the WordPress hook when a generic user is created, I risk calling these functions for non-seller users.

      I need a hook where I can hook for example this: do_action(‘mvx_after_register_vendor’, $user_id);

      but this only gives me the user_id and instead I need the sent fields of his registration form.

      Is there a hook that returns this information to me after the registration form has been submitted and after the user has been created?

      thank you very much

    • #193644
      matteor182
      Participant

      I found this filter : apply_filters(‘mvx_save_registration_fields’, $mvx_vendor_fields, $customer_id);

      I can use it to get the fields , but how can I write values in the custom fields I created without interrupting the seller ‘s registration ?
      is it possible from this filter ? can you write me a sample code? Or do I need only a hook?

      thank you very much

    • #193673
      This reply has been marked as private.
    • #193678
      matteor182
      Participant

      ok great, I’m just missing one piece of information, how do I recover the data from the submitted form? do I find it stored in the user profile , in the user meta data ?

      thanks a lot for the help

    • #193697

      @matteor182 The details of the vendor after registration get saved in the user meta table.
      You can fetch the user details from the user id.

    • #193760
      matteor182
      Participant

      i tried with this code,

      but it seems that the vendor form data is not yet written in this hook, or rather if i get them from any page the function returns me the registration form data, but from this hook this variable $vendor_application_data is empty.

      do you have any idea ?

      this is my code, thanks a lot

      add_action(‘mvx_after_register_vendor’, ‘tdm_register_agenzia_immobiliare’);
      function tdm_register_agenzia_immobiliare($user_id) {
      $vendor = get_mvx_vendor($user_id);
      $vendor_application_data = get_user_meta(absint($vendor->id), ‘mvx_vendor_fields’, true);
      error_log(print_r($vendor_application_data,true));
      foreach($vendor_application_data as $question){
      if($question[‘label’] == ‘Che tipo di venditore sie ?’ && $question[‘value’] != null){
      update_field( ‘vendita_immobiliare’, $question[‘value’], “user_”.$user_id );
      }
      }
      }

    • #193763
      matteor182
      Participant

      I solved the first problem, taking the data in POST $vendor_application_data = $_POST[‘mvx_vendor_fields’];

      this is the correct code, but unfortunately it seems that the custom field is not filled, i tried from another page and the instruction works and fills the custom field, but from the hook it seems not to work, if i look in the DB after the registration, it seems that the custom field is not in the user meta. how can i write in a userm meta from this hook ?

      this is the istruction : update_field( ‘vendita_immobiliare’, $question[‘value’], “user_”.$user_id );

      and hear my code correctly

      add_action(‘mvx_after_register_vendor’, ‘tdm_register_agenzia_immobiliare’);
      function tdm_register_agenzia_immobiliare($user_id) {
      $vendor = get_mvx_vendor($user_id);
      $vendor_application_data = $_POST[‘mvx_vendor_fields’];
      foreach($vendor_application_data as $question){
      if($question[‘label’] == ‘Che tipo di venditore sie ?’ && $question[‘value’] != null){
      update_field( ‘vendita_immobiliare’, $question[‘value’], “user_”.$user_id );
      }
      }
      }

    • #193768
      matteor182
      Participant

      ok I solved it, the problem was the comfort with the lable, it was always false, I don’t know why, now I compare it with the value and it recognizes it.

      thank you very much

    • #193773

      Great to hear that. Hope all your issues are solved now.

Viewing 12 reply threads

The topic ‘hoo or filter after vendor registration’ is closed to new replies.