Closed imath closed 7 months ago
Hi @imath and @renatonascalves
I was looking to use the new signup feature through the REST API in BuddyPress 14 but I am unable to send certain data successfully. I have countries/areas already setup for a few years now and when I send "Sacramento, California, United States" it is taken as 3 values when it is just one. When the user activates the account, the field is blank. Hoping for a reply! Cheers.
@berzki Are you using V1 or V2? Can you share the request?
@renatonascalves I am using the standard release version, so V1.
Field 2 is a checkbox field type. But this happens for any values with commas in them such as a location and that a user can select multiples of. This includes multi select field types.
Request:
{
"context" : "edit",
"user_login" : "mike",
"user_email" : "mike@user.mail",
"password" : "password",
"signup_field_data": [
{
"field_id": "1",
"value": "Mike"
},
{
"field_id": "2",
"value": "Sacramento, California, United States"
}
]
}
Response:
[
{
"id": 200,
"user_login": "mike",
"registered": "2024-10-03T00:36:33",
"registered_gmt": "2024-10-03T00:36:33",
"user_email": "mike@user.mail",
"date_sent": "2024-10-03T00:36:33",
"date_sent_gmt": "2024-10-03T00:36:33",
"count_sent": 0,
"meta": {
"field_1": "Mike",
"field_1_visibility": "public",
"field_2": [
"Sacramento",
"California",
"United States"
],
"field_2_visibility": "public",
"profile_field_ids": "1,2",
"sent_date": "0000-00-00 00:00:00",
"count_sent": 0
},
"_links": {
"self": [
{
"href": "https://www.website.com/wp-json/buddypress/v1/signup/200"
}
],
"collection": [
{
"href": "https://www.website.com/wp-json/buddypress/v1/signup/"
}
]
}
}
]
@berzki That's helpful. Can you also share the type of the field? Is it a text field? A multi-select one?
@renatonascalves The field is a checkbox type. I have tested it with a multi select box too and the result was the same.
Hi @imath and @renatonascalves
This appears to be by design? Meaning plugin users who have existing values with commas in them and are in checkboxes and multi select boxes cannot use the new signup feature. I am no expert, but I assume accepting them as arrays would solve this issue?
I agree with this ticket, we should mimic what we are making available from front end from the BP REST API.
See: https://buddypress.trac.wordpress.org/ticket/8976