Registration – User Meta Field Mappping
-
I managed to create a custom trigger through a form in the WordPress Bit Integrations plugin’s registration section. I successfully sent data to that section, which includes an email address and an array. I select and input this array in the “User Meta Field Mapping” section. However, when creating the user, this data doesn’t get associated with the user.
//My fetching; await fetch('/wp-json/myplugin/v1/bit_integrations', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ email: userDetails, canvasUniqueId: [{ id: canvasUniqueId }], }), })
//functions.php add_action('rest_api_init', function () { register_rest_route('myplugin/v1', '/bit_integrations', array( 'methods' => 'POST', 'callback' => 'bit_integrations_callback', )); }); function bit_integrations_callback($request) { // get the data from the request $email = $request->get_param('email'); $canvasUniqueId = $request->get_param('canvasUniqueId'); // trigger the custom trigger in bit-integrations do_action( 'bit_integrations_custom_trigger', '1e35ecfc-7241-477e-a988-65f7e01a880b', array('email' => $email, 'canvasUniqueId' => $canvasUniqueId), ); return rest_ensure_response('Success'); }
Custom trigger fetching;
Registration;
I tried every possible combination to test it. I even tried selecting text instead of an array when making the fetch. However, I still couldn’t get the desired outcome.
These are the outcomes;Only “test1” and “test2” have been saved; “test3” and “test4” are missing. “test2” has been saved as empty. “test1” has been saved, but it hasn’t been stored in array format. The format in the area highlighted in green is the array format.
Perhaps there’s a part that I’m not aware of or I might have done incorrectly. I would appreciate your assistance if you could help me with this.
- The topic ‘Registration – User Meta Field Mappping’ is closed to new replies.