Skip to content
Browse files

Enhancement for issue #7

small changes for performance on load for hide on dashboard and a new
functions to hide comment options on profile page, see issue #7
1 parent 5be3455 commit 7c74b9c80e1ca377b3d24fea5fec7f63e9e7ab18 @bueltge committed
Showing with 23 additions and 7 deletions.
  1. +23 −7 remove-comments-absolute.php
View
30 remove-comments-absolute.php
@@ -38,7 +38,8 @@ public function __construct() {
add_action( 'admin_menu', array( $this, 'remove_menu_items' ) );
add_filter( 'add_menu_classes', array( $this, 'add_menu_classes' ) );
- add_action( 'admin_head', array( $this, 'remove_comments_areas' ) );
+ // remove items in dashboard
+ add_action( 'admin_footer-index.php', array( $this, 'remove_comments_areas' ) );
add_action( 'wp_before_admin_bar_render', array( $this, 'admin_bar_render' ) );
@@ -51,6 +52,9 @@ public function __construct() {
// remove default comment widget
add_action( 'widgets_init', array( $this, 'unregister_default_wp_widgets' ), 1 );
+
+ // remove comment options in profile page
+ add_action( 'personal_options', array( $this, 'remove_profile_items' ) );
}
/**
@@ -190,12 +194,12 @@ function add_menu_classes( $menu ) {
public function remove_comments_areas() {
?>
<script type="text/javascript">
- //<![CDATA[
- jQuery(document).ready( function($) {
- $( 'div.table_discussion' ).css( 'display', 'none' );
- $( 'div.musubtable' ).css( "display", "block" );
- });
- //]]>
+ //<![CDATA[
+ jQuery(document).ready( function($) {
+ $( 'div.table_discussion' ).remove();
+ $( 'div.musubtable' ).remove();
+ });
+ //]]>
</script>
<?php
}
@@ -256,6 +260,18 @@ public function unregister_default_wp_widgets() {
unregister_widget('WP_Widget_Recent_Comments');
}
+ public function remove_profile_items() {
+ ?>
+ <script type="text/javascript">
+ //<![CDATA[
+ jQuery(document).ready( function($){
+ $('#your-profile .form-table tr:nth-child(3)').remove();
@wpdocde
wpdocde added a note

It should be

$('#your-profile .form-table tr:nth-child(2)').remove();

to solve my issue #7. I´m using WP 3.4.2.

@bueltge Owner
bueltge added a note

I I change to 2, then I can see the checkbox for comments keyboards. Maybe you have a screenshot without a replacement of this page in your backend; please add to issue #7 and reopen this issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ });
+ //]]>
+ </script>
+ <?php
+ }
+
/**
* On posts where comments are closed, the plugin will remove the text 'Comments are closed.'
*

0 comments on commit 7c74b9c

Please sign in to comment.
Something went wrong with that request. Please try again.