Created
November 27, 2017 17:54
-
-
Save dcavins/789e4b5409ed3cc2c167b9e3c7c93cb8 to your computer and use it in GitHub Desktop.
Change the default setting for the "edit" access level.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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