Skip to content

Commit 8df44f4

Browse files
committed
add possibility to deactivate facepiles
1 parent 310a310 commit 8df44f4

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

includes/class-admin.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ public static function discussion_settings() {
5151
printf( __( 'Based on your feedback and to improve the user experience, we decided to move the settings to a separate <a href="%1$s">settings-page</a>.', 'webmention' ), $path );
5252
}
5353

54-
public static function meta_boxes( $object, $box ) {
54+
/**
55+
* Add Webmention meta boxes to the comment editor screen.
56+
*
57+
* @param object $object The comment object.
58+
*/
59+
public static function meta_boxes( $object ) {
5560
wp_nonce_field( 'webmention_comment_metabox', 'webmention_comment_nonce' );
5661

5762
if ( ! $object instanceof WP_Comment ) {
@@ -467,6 +472,16 @@ public static function register_settings() {
467472
'default' => 1,
468473
)
469474
);
475+
register_setting(
476+
'webmention',
477+
'webmention_show_facepile',
478+
array(
479+
'type' => 'int',
480+
'description' => esc_html__( 'Show Facepile', 'webmention' ),
481+
'show_in_rest' => true,
482+
'default' => 1,
483+
)
484+
);
470485
register_setting(
471486
'webmention',
472487
'webmention_facepile_fold_limit',

includes/class-comment-walker.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ public static function init() {
2020
if ( separate_webmentions_from_comments() ) {
2121
add_action( 'pre_get_comments', array( static::class, 'comment_query' ) );
2222

23-
add_action( 'comment_form_before', array( static::class, 'show_separated_reactions' ) );
24-
add_action( 'comment_form_comments_closed', array( static::class, 'show_separated_reactions' ) );
23+
if ( \get_option( 'webmention_show_facepile', 1 ) ) {
24+
add_action( 'comment_form_before', array( static::class, 'show_separated_reactions' ) );
25+
add_action( 'comment_form_comments_closed', array( static::class, 'show_separated_reactions' ) );
26+
}
2527
}
2628
}
2729

templates/webmention-settings.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@
159159
</label>
160160
</fieldset>
161161

162+
<fieldset>
163+
<label for="webmention_show_facepile">
164+
<input type="checkbox" name="webmention_show_facepile" id="webmention_show_facepile" value="1" <?php checked( true, get_option( 'webmention_show_facepile', 1 ) ); ?> />
165+
<?php esc_html_e( 'Show Facepile.', 'webmention' ); ?>
166+
</label>
167+
</fieldset>
168+
162169
<fieldset>
163170
<label for="webmention_facepile_fold_limit">
164171
<input type="number" min="0" class="small-text" name="webmention_facepile_fold_limit" id="webmention_facepile_fold_limit" value="<?php echo esc_attr( get_option( 'webmention_facepile_fold_limit' ) ); ?>" />

0 commit comments

Comments
 (0)