Skip to content

Instantly share code, notes, and snippets.

@dcavins
Created March 27, 2024 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcavins/cb7db0b02cdbbdaa2efda46a32e3ef4d to your computer and use it in GitHub Desktop.
Save dcavins/cb7db0b02cdbbdaa2efda46a32e3ef4d to your computer and use it in GitHub Desktop.
Change the default access options for new BP Docs.
<?php
add_filter( 'bp_docs_get_default_access_options', 'my_change_docs_default_access_levels' );
function my_change_docs_default_access_levels( $defaults ) {
/**
* Possible access capabilities are 'read', 'edit', 'read_comments', 'post_comments',
* 'view_history', or 'manage'.
* Possible access options are 'loggedin', 'creator', or 'anyone'.
* If BuddyPress groups are activated, then additional access options are available
* to docs that are associated with a group:
* 'group-members' and 'admins-mods'.
* The default 'read' setting for a new doc is 'anyone';
* to change the default 'read' capability to 'loggedin', you'd do:
*/
$defaults['read'] = 'loggedin';
return $defaults;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment