Skip to content
Permalink
Browse files

Allow comments to be posted and displayed group events. Allow front-e…

…nd control of whether or not comments are open.
  • Loading branch information...
rjbaniel committed Nov 1, 2017
1 parent d3bd473 commit 4055fd63524091313396a9093e900e59fb906cfc
@@ -632,6 +632,17 @@ function bpeo_render_silent_checkbox( $post_type, $location, $post ) {
}
add_action( 'do_meta_boxes', 'bpeo_render_silent_checkbox', 10, 3 );
/**
* Override BP Core filter that sets comment_status to closed for all BP pages
*/
function bpeo_show_event_comments( $retval, $open, $post_id ) {
if ( $open && ! $retval && get_post_type( $post_id ) === 'event' ){
return true;
} else {
return $retval;
}
}
add_filter( 'bp_force_comment_status', 'bpeo_show_event_comments', 10, 3 );
/** Embed ********************************************************************/
/**
@@ -839,6 +839,35 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
}
endif;
/** DUPLICATES - POST COMMENT STATUS ***********************************/
if ( ! function_exists( 'post_comment_status_meta_box' ) ) :
/**
* Display post comment status form fields. (E.g. "Allow comments")
*
* WFAS Mods:
* - Removed "Allow pingbacks" checkbox
*
* @param object $post
*/
function post_comment_status_meta_box($post, $args = array() ) {
?>
<p class="meta-options">
<label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e( 'Allow comments' ) ?></label>
<?php
/**
* Fires at the end of the Discussion meta box on the post editing screen.
*
* @since 3.1.0
*
* @param WP_Post $post WP_Post object of the current post.
*/
do_action( 'post_comment_status_meta_box-options', $post );
?>
</p>
<?php
}
endif;
/** DUPLICATES - POST SUBMIT META BOX ***********************************/
if ( ! function_exists( 'post_submit_meta_box' ) ) :
@@ -99,6 +99,7 @@ class WP_Frontend_Admin_Screen {
'last_edited_on' => __( 'Last edited on %1$s at %2$s' ),
'button_publish' => __( 'Publish' ),
'button_update' => __( 'Update' ),
'comments_status' => __( 'Discussion' ),
'tag_delimiter' => _x( ',', 'tag delimiter' ),
'featured_image' => __( 'Featured Image' ),
'title_publish' => __( 'Publish' ),
@@ -275,7 +276,6 @@ public function display() {
?>

<h2 class="admin-page-title"><?php esc_html_e( $title ); ?></h2>

<div id="post-body">
<form id="post" method="post" action="" name="post">
<?php wp_nonce_field( 'update-post_' . $post->ID ); ?>
@@ -353,6 +353,9 @@ public function display() {
// publish metabox
add_meta_box( 'submitdiv', $this->strings['title_publish'], 'post_submit_meta_box', self::$post_type, 'side', 'low' );
// allow comments metabox
add_meta_box( 'commentstatusdiv', $this->strings['comments_status'], 'post_comment_status_meta_box', self::$post_type, 'side', 'low' );
// taxonomy metaboxes
foreach ( get_object_taxonomies( $post ) as $tax_name ) {
$taxonomy = get_taxonomy( $tax_name );
@@ -13,3 +13,8 @@
<?php endif; ?>

<?php bpeo_the_single_event_action_links(); ?>

<!-- If comments are enabled, show them -->
<div class="comments-template">
<?php comments_template(); ?>
</div>

0 comments on commit 4055fd6

Please sign in to comment.
You can’t perform that action at this time.