BP-REST
BP-REST copied to clipboard
Add Group Type and Member Type Taxonomies
Since BP 7.0.0, Admin Types have been added to the Group and Member components. The Rest API should be updated to reflect these changes.
Thanks to this, it will be possible to use the REST API to update the interface of the administration with JavaScript. For reference : https://buddypress.trac.wordpress.org/ticket/8409
I agree it would be a nice addition now that we are using the site's database for Member Types/Group Types registration.
I don't use this feature quite often, so it would be good to have more information here:
- Endpoint namespace. Any preference?
-
http://site.com/wp-json/buddypress/v1/member|group_types/
? - Schema of a group/member type?
- Who can delete/add/update group/member types?
- Any other information one should be aware of when implementing these endpoints?
Hi!
- For the namespace, I'd rather we use
member-types
andgroup-types
- common schema for member types and group types: https://github.com/buddypress/buddypress/blob/master/src/bp-core/bp-core-functions.php#L3207|L3249
- Specific schema for member type: https://github.com/buddypress/buddypress/blob/master/src/bp-members/bp-members-functions.php#L2763|L2787
- Specific schema for group type: https://github.com/buddypress/buddypress/blob/master/src/bp-groups/bp-groups-functions.php#L2626|L2658
- delete, add, update, assign =>
'bp_moderate'
| group admins - Types are specific WP Terms all registered on this site id :
bp_get_taxonomy_term_site_id( bp_get_member_type_tax_name() )
andbp_get_taxonomy_term_site_id( bp_get_group_type_tax_name() )
- Informations about types are using Terms metadata or data registered with code see
bp_get_member_types()
andbp_groups_get_group_types()
, in Terms db only the slug and name of the BP Type are used. - Functions about types are mainly in:
- https://github.com/buddypress/buddypress/blob/master/src/bp-core/bp-core-taxonomy.php
- https://github.com/buddypress/buddypress/blob/master/src/bp-members/bp-members-functions.php#L2644|L3264
- https://github.com/buddypress/buddypress/blob/master/src/bp-groups/bp-groups-functions.php#L2468|L3136
OOps, I forgot: NB: Group Admins can also assign group types