hierarchical-groups-for-bp
hierarchical-groups-for-bp copied to clipboard
allow only admins and editors to add root level groups
- added hierarchy as second step in group creation
this was a requirement for our site. if not something you think its needed ignore the PR :) won't take it personal :)
Hi @cezarneaga-
Thanks for the pull request! I can see where this would be useful for some/many communities. I have a few concerns about making this change:
• Some communities would prefer that anyone can create a group at any level. Do we make your suggested change an option so that the site admin can choose? I think this would work OK. • BuddyPress also has a setting that we'll need to honor/work with in a way that makes sense:
Enable group creation for all users. Administrators can always create groups, regardless of this setting.
I don't think it conflicts with the thinking behind your change, but it's good to keep in mind that there's another setting somewhere else that controls group creation.
Code comments:
• The check in user_can_create_topLevelGroups()
should instead be handled using WP's permissions system, so we'd check like this: bp_current_user_can( 'hgbp_create_top_level_groups' )
and add a new case to HGBP_Public::check_user_caps()
here: https://github.com/dcavins/hierarchical-groups-for-bp/blob/master/public/class-hgbp.php#L520. I'd guess that we should use the generic BP "do-anything" capability, bp_user_can( $user_id, 'bp_moderate' )
for this check. Another advantage of using bp_current_user_can()
is that devs can easily filter the response.
Let me know what you think.
Thanks again!
-David
i totally agree. with all points.
Do you have time/interest to make the changes (or some part of the changes)? Maybe we can split the labor:
• You: Change the permission check from user_can_create_topLevelGroups()
to a bp_current_user_can()
check.
• Me: Add the setting to the settings screen that enables the restriction (and check the new setting in the current_user_can
filter).
Does that sound good?
-David
yeap. short on time but this shouldn't take too long :)
Hi thanks for this plugin. I was wondering is it easy to implement auto join to parent groups? Something like this http://www.generalthreat.com/2011/12/extending-groups-hierarchy-join-upstream/
@canyasa Sure. This works for me: https://gist.github.com/dcavins/c7877bd0760c14a7740384b58e588ab3