Created
April 13, 2021 13:39
-
-
Save dcavins/65154f3f39c1a8cf8e78dadd2992a6a7 to your computer and use it in GitHub Desktop.
Set every new BP doc to pending status.
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 ) { | |
if ( ! current_user_can( 'bp_moderate' ) && $bdq_object->is_new_doc ) { | |
// Set the post status as "pending". | |
$save_args['post_status'] = 'bp_docs_pending'; | |
} | |
return $save_args; | |
} | |
add_filter( 'bp_docs_post_args_before_save', 'bpdocs_support_mark_all_as_pending', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment