[buddypress-trac] [BuddyPress Trac] #8976: Registration through REST API with additional profile fields

buddypress-trac noreply at wordpress.org
Wed Apr 24 01:54:30 UTC 2024


#8976: Registration through REST API with additional profile fields
--------------------------------------+--------------------------
 Reporter:  niftythree                |       Owner:  espellcaste
     Type:  enhancement               |      Status:  assigned
 Priority:  normal                    |   Milestone:  14.0.0
Component:  REST API                  |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |
--------------------------------------+--------------------------

Comment (by espellcaste):

 @niftythree I would need more information here since I can't replicate
 this issue via the API.


 > The order of individual profile fields is not preserved when an account
 is pending, when submitted through the REST API; i.e. the order of profile
 fields is different for an active account when compared to a pending
 account

 This part is not clear to me. A pending account is still a signup. And the
 data of the signup is returned like so. So there is no profile fields for
 pending accounts.

 {{{
 [
   {
     "count_sent": 0,
     "date_sent": "2024-04-20T04:20:25",
     "date_sent_gmt": "2024-04-20T04:20:25",
     "id": 12,
     "meta": {
       "count_sent": 0,
       "field_1": "User Test 07",
       "field_19": [
         "Option 01",
         "Option 03"
       ],
       "field_19_visibility": "public",
       "profile_field_ids": "19",
       "sent_date": "0000-00-00 00:00:00"
     },
     "registered": "2024-04-20T04:20:25",
     "registered_gmt": "2024-04-20T04:20:25",
     "user_email": "user_07 at gmail.com",
     "user_login": "user07",
     "user_name": "User Test 07"
   }
 ]
 }}}

 > The output display order of "Custom" ordered field options (e.g. the
 different checkboxes within one profile field) when submitted through the
 REST API isn't preserved. Options are displayed in the order they are
 sent.

 This is another report I can't replicate. Here is the output I see for
 getting profile fields for a particular user. The order is set to
 "Custom". And the field is a checkboxes field.

 https://wp.test/wp-json/buddypress/v1/xprofile/fields/

 {{{
 [
   {
     "_links": {
       "collection": [
         {
           "href": "https://bar.wp.test/wp-
 json/buddypress/v1/xprofile/fields/"
         }
       ],
       "group": [
         {
           "embeddable": true,
           "href": "https://bar.wp.test/wp-
 json/buddypress/v1//xprofile/groups/1"
         }
       ],
       "self": [
         {
           "href": "https://bar.wp.test/wp-
 json/buddypress/v1/xprofile/fields/1"
         }
       ]
     },
     "can_delete": false,
     "data": {
       "id": 9,
       "value": {
         "raw": "User 14",
         "rendered": "<p>User 14</p>\n",
         "unserialized": [
           "User 14"
         ]
       }
     },
     "description": {
       "rendered": ""
     },
     "field_order": 0,
     "group_id": 1,
     "id": 1,
     "is_default_option": false,
     "is_required": true,
     "name": "Name",
     "option_order": 0,
     "options": [],
     "order_by": "",
     "parent_id": 0,
     "type": "textbox"
   },
   {
     "_links": {
       "collection": [
         {
           "href": "https://bar.wp.test/wp-
 json/buddypress/v1/xprofile/fields/"
         }
       ],
       "group": [
         {
           "embeddable": true,
           "href": "https://bar.wp.test/wp-
 json/buddypress/v1//xprofile/groups/1"
         }
       ],
       "self": [
         {
           "href": "https://bar.wp.test/wp-
 json/buddypress/v1/xprofile/fields/2"
         }
       ]
     },
     "can_delete": true,
     "data": {
       "id": 0,
       "value": {
         "raw": "",
         "rendered": "",
         "unserialized": []
       }
     },
     "description": {
       "rendered": ""
     },
     "field_order": 1,
     "group_id": 1,
     "id": 2,
     "is_default_option": false,
     "is_required": false,
     "name": "Text Box Test Field - #9127",
     "option_order": 0,
     "options": [],
     "order_by": "",
     "parent_id": 0,
     "type": "textbox"
   },
   {
     "_links": {
       "collection": [
         {
           "href": "https://bar.wp.test/wp-
 json/buddypress/v1/xprofile/fields/"
         }
       ],
       "group": [
         {
           "embeddable": true,
           "href": "https://bar.wp.test/wp-
 json/buddypress/v1//xprofile/groups/1"
         }
       ],
       "self": [
         {
           "href": "https://bar.wp.test/wp-
 json/buddypress/v1/xprofile/fields/19"
         }
       ]
     },
     "can_delete": true,
     "data": {
       "id": 10,
       "value": {
         "raw": "a:2:{i:0;s:9:\"Option 01\";i:1;s:9:\"Option 03\";}",
         "rendered": "<p>Option 01, Option 03</p>\n",
         "unserialized": [
           "Option 01",
           "Option 03"
         ]
       }
     },
     "description": {
       "rendered": "testing description"
     },
     "field_order": 2,
     "group_id": 1,
     "id": 19,
     "is_default_option": false,
     "is_required": true,
     "name": "Checkbox",
     "option_order": 0,
     "options": [
       {
         "can_delete": true,
         "description": {
           "rendered": ""
         },
         "field_order": 0,
         "group_id": 1,
         "id": 26,
         "is_default_option": false,
         "is_required": false,
         "name": "Option 01",
         "option_order": 1,
         "order_by": "",
         "parent_id": 19,
         "type": "option"
       },
       {
         "can_delete": true,
         "description": {
           "rendered": ""
         },
         "field_order": 0,
         "group_id": 1,
         "id": 27,
         "is_default_option": false,
         "is_required": false,
         "name": "Option 02",
         "option_order": 2,
         "order_by": "",
         "parent_id": 19,
         "type": "option"
       },
       {
         "can_delete": true,
         "description": {
           "rendered": ""
         },
         "field_order": 0,
         "group_id": 1,
         "id": 28,
         "is_default_option": false,
         "is_required": false,
         "name": "Option 03",
         "option_order": 3,
         "order_by": "",
         "parent_id": 19,
         "type": "option"
       }
     ],
     "order_by": "CUSTOM",
     "parent_id": 0,
     "type": "checkbox"
   }
 ]
 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8976#comment:10>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list