Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editable item type slugs and better syncing with BP item type taxonomies #346

Open
boonebgorges opened this issue Mar 25, 2021 · 0 comments
Assignees
Labels
Enhancement OpenLab Issues specifically related to the OpenLab package

Comments

@boonebgorges
Copy link
Member

Previously: #332

CBOX-OL stores item types as post types (cboxol_member_type and cboxol_group_type). At runtime, we register them as BP group/member types, using bp_register_member_type() and bp_register_group_type(). This generally worked as long as the taxonomy was totally invisible - used only for storage - which was the case until BP 7.0. Since 7.0, BuddyPress provides an interface for creating and managing these tags via edit-tags.php. But this introduces lots of problems. A few considerations:

  • Deleting a CBOX item type doesn't delete the corresponding WP term
  • Deleting a WP item type term doesn't delete the corresponding CBOX item type
  • When you edit the BP term's slug, it's not reflected in the CBOX system, meaning that certain things break (like group- and member-type-specific directories). Since Compatibility with BP 7.0.0 member- and group-type systems #332 it's not possible to edit these terms in the wp-admin interface, but there are ways around this restriction, such as wp-cli.

So in general there's a lack of proper synchronization between the two sets of data. In the short term, we are mitigating this problem by preventing certain kinds of editing. But in the long term, we should instead improve the sync mechanisms. Among other things, this will open the door to allowing admins to change the slugs of their group/member types.

The key here will be to designate the WP taxonomy term as the source of truth for 'slug'. Then, in CBOX-OL, we will use this value when building URLs, etc. It will also likely mean that we can no longer use the slug as the unique and immutable identifier of item types in CBOX-OL. We'll probably introduce a new property such as id, which will be populated at creation by slug, but will then be independent of slug; id will be stored in post_name and will be unchangeable, while slug will be pulled from the corresponding WP term.

Once we've uncoupled slug and id and ensured proper syncing where necessary, we can re-allow edit-tags.php editing. We can also introduce an editable slug field in on the CBOX item-type editing interface.

@boonebgorges boonebgorges added Enhancement OpenLab Issues specifically related to the OpenLab package labels Mar 25, 2021
@boonebgorges boonebgorges added this to the Future Release milestone Mar 25, 2021
@boonebgorges boonebgorges self-assigned this Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement OpenLab Issues specifically related to the OpenLab package
Projects
None yet
Development

No branches or pull requests

1 participant