Permalink
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
  • Loading branch information...
bueltge committed Sep 3, 2012
1 parent 5be3455 commit 7c74b9c80e1ca377b3d24fea5fec7f63e9e7ab18
Showing with 23 additions and 7 deletions.
  1. +23 −7 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();

This comment has been minimized.

Show comment
Hide comment
@wpdocde

wpdocde Oct 22, 2012

It should be

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

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

@wpdocde

wpdocde Oct 22, 2012

It should be

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

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

This comment has been minimized.

Show comment
Hide comment
@bueltge

bueltge Oct 23, 2012

Owner

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.

@bueltge

bueltge Oct 23, 2012

Owner

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.

+ });
+ //]]>
+ </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.