This file contains 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 ) { | |
/** | |
* 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'. |
This file contains 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_map_meta_caps', 'bp_docs_groups_allow_group_admins_to_manage_access', 20, 4 ); | |
function bp_docs_groups_allow_group_admins_to_manage_access( $caps, $cap, $user_id, $args ) { | |
// We only want to act on the "manage" capability, in group situations. | |
if ( 'bp_docs_manage' !== $cap ) { | |
return $caps; | |
} | |
$doc = bp_docs_get_doc_for_caps( $args ); | |
if ( empty( $doc ) ) { | |
return $caps; |
This file contains 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 | |
// Enables folders for group, user, and global doc directories. | |
add_filter( 'bp_docs_enable_folders_for_current_context', '__return_true' ); | |
// Shows the folder metabox on the doc edit screen. | |
add_filter( 'bp_docs_folders_force_metabox', '__return_true' ); |
This file contains 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 | |
// Ignore folder association temporarily. | |
remove_filter( 'bp_docs_tax_query', 'bp_docs_folder_tax_query', 10, 2 ); | |
$doc_args = array( | |
// 'folder' => , | |
'posts_per_page' => 50, | |
'paged' => 1, // increment this to work through the docs. | |
); | |
if ( bp_docs_has_docs( $doc_args ) ) : |
This file contains 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 | |
/** | |
* If a user submits a site membership request, but has a | |
* 'my-school.edu' email address, bypass the manual approval of the request. | |
* | |
* @param bool $send Whether or not this membership request should be approved | |
* immediately and the activation email sent. | |
* Default is `false` meaning that the request should be | |
* manually approved by a site admin. | |
* @param array $details The details of the request. |
This file contains 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 | |
/** | |
* Allow group admins and mods to read and edit any BP Doc | |
* associated with a group they moderate. | |
* Note: this will allow direct access at `/docs/doc-title/` but | |
* the docs will not be listed in the group docs directory if the | |
* access level "should" prevent the user from accessing it. | |
* So it's of limited usefulness. | |
* | |
* @param string[] $caps Primitive capabilities required of the user. |
This file contains 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', 'remove_creator_option_for_group_docs', 10, 4 ); | |
function remove_creator_option_for_group_docs( $options, $settings_field, $doc_id = 0, $group_id = 0 ) { | |
if ( ! $group_id ) { | |
$group_id = bp_docs_get_associated_group_id( $doc_id ); | |
} | |
// If this is the Doc creation page, check to see whether a | |
// group id has been passed somewhere | |
if ( empty( $group_id ) ) { |
This file contains 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 | |
/** | |
* Mark all new docs as pending. | |
* | |
* @param array $r The parameters to be used in wp_insert_post(). | |
* @param object $this The BP_Docs_Query object. | |
* @param array $args The passed and filtered parameters for the doc | |
* about to be saved. | |
*/ | |
function bpdocs_support_mark_all_as_pending( $save_args, $bdq_object, $passed_args ) { |
This file contains 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 the Google tag manager script in the header. | |
* | |
* @since 1.0.0 | |
* | |
*/ | |
function prefix_add_google_tag_manager_script() { | |
if ( function_exists( 'wp_get_environment_type' ) | |
&& 'production' !== wp_get_environment_type() ) { |
This file contains 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="Media Media--reverse"> | |
<img src="/wp-content/uploads/sites/6/2019/11/doubtful-kitty.jpg" alt="A cat that doubts your ideas." width="100" height="100" class="Media-figure size-full wp-image-1350" /> | |
<div class="Media-body"> | |
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer sit amet blandit lacus. Proin bibendum eros ut turpis tempor finibus. Vivamus ac scelerisque lectus. Nullam in justo vel mauris fermentum tempus.</p> | |
</div> | |
</div> |
NewerOlder