Guest User

Untitled

a guest
May 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2. add_filter( 'bp_docs_map_meta_caps', function( $caps, $cap, $user_id, $args ) {
  3. if ( 'bp_docs_create' === $cap ) {
  4. // Site admins
  5. if ( user_can( $user_id, 'bp_moderate' ) ) {
  6. $caps = array( 'exist' );
  7. // If this is a group and the user is a group mod or admin.
  8. } else if ( bp_is_group() && ( bp_group_is_mod() || bp_group_is_admin() ) ) {
  9. $caps = array( 'exist' );
  10. } else {
  11. $caps = array( 'do_not_allow' );
  12. }
  13. }
  14. return $caps;
  15. }, 20, 4 );
Add Comment
Please, Sign In to add comment