cuny-academic-commons / commons-in-a-box

Commons In A Box - A suite of community and collaboration tools for WordPress, designed especially for academic communities
http://commonsinabox.org
72 stars 14 forks source link

BP "nav" functions should be more easily extended #473

Open boonebgorges opened 2 months ago

boonebgorges commented 2 months ago

Currently, we have functions like openlab_group_membership_tabs(), which certain BP subnavs. These functions are then called across multiple single-group templates. This makes it hard to customize or extend the nav items: you can fork openlab_group_membership_tabs(), but then you have to override each of the functions that call the tabs.

Let's make this easier. In an ideal world, we'd use BP functions to register and spit out nav menus in a proper way. This would require a pretty extensive rewrite. But we can make the more modest improvement of moving the markup into a template file. Maybe something like this:

  1. Move the guts of openlab_group_membership_tabs() into a file openlab-theme/buddypress/groups/single/tabs-membership.php
  2. In openlab_group_membership_tabs(), use bp_get_template_part() to load the new template
  3. Do something similar for other similar functions

It'd be more transparent to call bp_get_template_part() directly from the template files, but this would require changes across lots of theme templates, which increases the chances that the change won't be picked up by custom child themes. The approach sketched above should be 100% backward-compatible.