Skip to content

Instantly share code, notes, and snippets.

@dcavins
Created November 27, 2017 17:54
Show Gist options
  • Select an option

  • Save dcavins/789e4b5409ed3cc2c167b9e3c7c93cb8 to your computer and use it in GitHub Desktop.

Select an option

Save dcavins/789e4b5409ed3cc2c167b9e3c7c93cb8 to your computer and use it in GitHub Desktop.
Change the default setting for the "edit" access level.
<?php
add_filter( 'bp_docs_get_access_options', 'wpsupp_edit_default_access_settings', 10, 4 );
function wpsupp_edit_default_access_settings( $options, $settings_field, $doc_id, $group_id ) {
// Only change the "edit" setting default
if ( 'edit' === $settings_field ) {
foreach ( $options as $id => $settings ) {
// 90 is the id of the "creator" level. Set that to be default. Others, not the default.
if ( 90 === $id ) {
$options[$id]['default'] = 1;
} else {
$options[$id]['default'] = 0;
}
}
}
return $options;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment