buddypress/tests/phpunit/assets
Boone B Gorges 6174a54d60 Overhaul access and visibility control for group tabs
Previously, access control to group tabs was handled in two ways:
- for BP_Group_Extension tabs, the 'enable_nav_item' and 'visibility' provided
  some control over access to plugin developers, though it was inconsistent,
  buggy, and difficult to implement properly
- for tabs provided by bp-groups, access to the tabs of non-public groups was
  controlled directly in the BP_Groups_Component::setup_globals() method

Aside from being unclear for developers, this technique for controlling access
was also inflexible. For non-public groups, tab access was hardcoded and
handled before BP_Group_Extension plugins even had a chance to load. As a
result, it was essentially impossible to add public tabs to non-public groups
(among other non-standard customizations).

The current changeset comprises a number of changes that make tab access more
consistent and flexible:

- Access control is moved to the new bp_groups_group_access_protection()
  function. This function has the necessary filters to customize access
  protection in arbitrary ways. And because it loads at 'bp_actions' - just
  before the page begins to render - all extensions have had a chance to load
  and register themselves with the desired access settings.
- The 'visibility' and 'enable_nav_item' properties of BP_Group_Extension are
  phased out in favor of 'access' and 'show_tab' params. 'access' controls who
  can visit the tab, while 'show_tab' controls who can see the item in the
  navigation. These new properties have intelligent defaults (based on the
  privacy level of the group), but can be overridden with a number of custom
  settings: 'admin', 'mod', 'member', 'loggedin', 'anyone', or 'noone'.
  Backward compatibility is maintained, so that existing BP_Group_Extension
  plugins that use enable_nav_item or visibility will continue to work as
  before.

Fixes #4785

Props boonebgorges, dcavins, imath

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8605 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
2014-07-12 01:26:36 +00:00
..
group-extensions.php Overhaul access and visibility control for group tabs 2014-07-12 01:26:36 +00:00