• Resolved loopforever

    (@loopforever)


    Hello,
    I am performing a Vendor Registration with a plugin. I am collecting data as array in a metakey named xyz_vendor. The Vendor needs to be activated after the registration phase. So far everything is perfect.
    After the vendor is activated, a row named dokan_profile_settings is created in the usermeta table. As you know here store_name etc. there is a lot of data.

    The registration plugin I’m using provides me with a hook: user_activated.
    Using this hook I want to assign the store_name that I got in the past after the vendor is activated. But after the code runs, all other data in dokan_profile_settings (For example phone) is deleted. How can I prevent this?
    Thank you from now. Can you help me ? My code is below.

    add_action('user_activated', 'new_vendor_activated',10);
    function new_vendor_activated ($user_id){
    $store_name = get_user_meta($user_id, 'xyz_vendor');
    $new_store_name = array('store_name'=>$store_name[0]['store_name']);
    //Update Store Name 
    update_user_meta($user_id, 'dokan_profile_settings',$new_store_name);
    }

    2-) I didn’t want to open a topic again. Is there a way to remove the array named [profile_completion] in the dokan_profile_settings meta?

    • This topic was modified 4 years, 6 months ago by loopforever.
Viewing 1 replies (of 1 total)
  • Plugin Support Jahidul Hassan Mojumder

    (@jahidulhassan)

    Hi @loopforever

    If you want to modify the dokan_profile_settings then first you will need to fetch the data from the meta and store it in a variable. Then add the value of the variable $store_name that you have added in your code and then pass the variable using the update_user_meta hook.

    About the second query, you can follow the same process that I have mentioned above and after fetching the meta value, remove the key-value pair you want to remove and then update the user meta.

    Thanks!

Viewing 1 replies (of 1 total)

The topic ‘Dokan Register Metadata Problem’ is closed to new replies.