[buddypress-trac] [BuddyPress Trac] #4785: Decouple "visibility" and "access" properties

buddypress-trac noreply at wordpress.org
Sat Jul 12 01:26:37 UTC 2014

#4785: Decouple "visibility" and "access" properties
 Reporter:  smninja      |       Owner:  boonebgorges
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  2.1
Component:  Groups       |     Version:  1.7
 Severity:  normal       |  Resolution:  fixed
 Keywords:  has-patch    |
Changes (by boonebgorges):

 * owner:   => boonebgorges
 * status:  new => closed
 * resolution:   => fixed


 In [changeset:"8605"]:
 #!CommitTicketReference repository="" revision="8605"
 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'
   some control over access to plugin developers, though it was
   buggy, and difficult to implement properly
 - for tabs provided by bp-groups, access to the tabs of non-public groups
   controlled directly in the BP_Groups_Component::setup_globals() method

 Aside from being unclear for developers, this technique for controlling
 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
 (among other non-standard customizations).

 The current changeset comprises a number of changes that make tab access
 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' -
   before the page begins to render - all extensions have had a chance to
   and register themselves with the desired access settings.
 - The 'visibility' and 'enable_nav_item' properties of BP_Group_Extension
   phased out in favor of 'access' and 'show_tab' params. 'access' controls
   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
   settings: 'admin', 'mod', 'member', 'loggedin', 'anyone', or 'noone'.
   Backward compatibility is maintained, so that existing
   plugins that use enable_nav_item or visibility will continue to work as

 Fixes #4785

 Props boonebgorges, dcavins, imath

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4785#comment:39>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list