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 { |
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 | |
function my_docs_create_follow_group_associate_setting( $caps, $cap, $user_id, $args ) { | |
if ( 'bp_docs_create' == $cap && $group_id = bp_get_current_group_id() ) { | |
// In a group, only set this cap if the user can associate a doc with the group. | |
if ( current_user_can( 'bp_docs_associate_with_group', $group_id ) ) { | |
$caps[] = 'exist'; | |
} else { | |
$caps[] = 'do_not_allow'; | |
} | |
} |
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 | |
function bpcodex_remove_member_friends_nav_tab() { | |
// Stop now if: | |
// This isn't a user profile | |
// This is the current user's profile | |
// The user is a site admin | |
if ( ! bp_is_user() || bp_is_my_profile() || is_super_admin() ) { | |
return; | |
} |
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 | |
/** | |
* Create an activity item to appear in a group. Fires once a post has been saved. | |
* | |
* @param int $post_ID Post ID. | |
* @param WP_Post $post Post object. | |
* @param bool $update Whether this is an existing post being updated or not. | |
*/ | |
function add_activity_item_for_group( $post_id, $post_object, $update ) { |
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
<div class="Grid Grid--guttersLg Grid--full med-Grid--1of2"> | |
<div class="Grid-cell"> | |
1/2 | |
</div> | |
<div class="Grid-cell"> | |
1/2 | |
</div> | |
<div class="Grid-cell"> | |
1/2 | |
</div> |
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
<div class="Grid Grid--guttersLg Grid--full med-Grid--fit"> | |
<div class="Grid-cell"> | |
2/3 | |
</div> | |
<div class="Grid-cell u-1of3"> | |
1/3 | |
</div> | |
</div> |
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
<div class="Grid Grid--guttersLg Grid--full med-Grid--fit"> | |
<div class="Grid-cell"> | |
1/3 | |
</div> | |
<div class="Grid-cell"> | |
1/3 | |
</div> | |
<div class="Grid-cell"> | |
1/3 | |
</div> |
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 | |
/* groups_join_group is called whenever someone joins a group. */ | |
add_action('groups_join_group', 'group_join_add_ancestors', 10, 2); | |
function group_join_add_ancestors( $group_id, $user_id ) { | |
// I'm assuming that you'll want to join to all ancestors: | |
$ancestor_ids = hgbp_get_ancestor_group_ids( $group_id ); | |
// To only include groups that the user can visit, use this version: | |
// $ancestor_ids = hgbp_get_ancestor_group_ids( $group_id, $user_id ); |
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_doc_attachments_args', 'dc_order_docs_attachments_by_title' ); | |
function dc_order_docs_attachments_by_title( $args ) { | |
$args['orderby'] = 'title'; | |
$args['order'] = 'ASC'; | |
return $args; | |
} |
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_default_access_options', 'my_change_docs_default_access_levels' ); | |
function my_change_docs_default_access_levels( $defaults ) { | |
$defaults['read'] = 'loggedin'; | |
return $defaults; | |
} |