BP-REST icon indicating copy to clipboard operation
BP-REST copied to clipboard

Add Group Type and Member Type Taxonomies

Open JeanDavidDaviet opened this issue 4 years ago • 4 comments

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

JeanDavidDaviet avatar Dec 11 '20 09:12 JeanDavidDaviet

I agree it would be a nice addition now that we are using the site's database for Member Types/Group Types registration.

imath avatar Dec 11 '20 18:12 imath

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?

renatonascalves avatar Mar 24 '21 00:03 renatonascalves

Hi!

  1. For the namespace, I'd rather we use member-types and group-types
  2. common schema for member types and group types: https://github.com/buddypress/buddypress/blob/master/src/bp-core/bp-core-functions.php#L3207|L3249
  3. Specific schema for member type: https://github.com/buddypress/buddypress/blob/master/src/bp-members/bp-members-functions.php#L2763|L2787
  4. Specific schema for group type: https://github.com/buddypress/buddypress/blob/master/src/bp-groups/bp-groups-functions.php#L2626|L2658
  5. delete, add, update, assign => 'bp_moderate'| group admins
  6. Types are specific WP Terms all registered on this site id : bp_get_taxonomy_term_site_id( bp_get_member_type_tax_name() ) and bp_get_taxonomy_term_site_id( bp_get_group_type_tax_name() )
  7. Informations about types are using Terms metadata or data registered with code see bp_get_member_types() and bp_groups_get_group_types(), in Terms db only the slug and name of the BP Type are used.
  8. 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

imath avatar Jun 18 '21 03:06 imath

OOps, I forgot: NB: Group Admins can also assign group types

imath avatar Jun 18 '21 03:06 imath