• Resolved duelistNick

    (@duelistnick)


    I have built a community using Multisite/Buddypress, but recently we had an issue where a blog owner used the Email Address of a commenter to stalk and harass them. I am trying to block Site Admins from being able to see this information in their dashboard and notification emails.

    This is the code I cobbled together to block Email/IP from the Comments Menu:

    // Testing IP/EMail block functions
    if( !current_user_can('manage_network') ){
     function my_filter_IP(){
       return "";
     }
     add_filter('get_comment_author_IP', 'my_filter_IP');
     add_filter('comment_email', 'my_filter_IP');
    }

    I tested this out on a SingleSite installation and it worked fine, but when I moved it into a plugin on my MultiSite install, the site went dead. I had to FTP in and remove the code for the site to function again.

    Any ideas on how I can make this happen for MultiSite?

    Also I’ve been unable to find a way to filter the Email addresses in the “Users” menu, or to stop the comment notification emails from giving this information out. Any help would be greatly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • When a white screen appears, check your error_log

    I offer this: do the role/cap check at the same time the filter is run, less errors with wp_get_current_user .

    plugin:

    <?php
    // Testing IP/EMail block functions
    
    function my_filter_IP($ip) {
    if (is_super_admin()) {
    	   return $ip;
    	} else {
    	   return;
    	}
    }
    add_filter( 'get_comment_author_IP', 'my_filter_IP' );
    add_filter( 'comment_email', 'my_filter_IP' );

    “to filter the Email addresses in the “Users” menu,”

    add_action('manage_users_columns','ds_remove_user_column');
    function ds_remove_user_column($column_headers) {
    if (!is_super_admin())
        unset($column_headers['email']);
        return $column_headers;
    }

    “to stop the comment notification emails”

    I offer this: the function wp_notify_postauthor is pluggable. Which means you can basically copy and paste the entire function from /wp-includes/pluggable.php into your own plugin and fiddle with it as much or a s little as you like.

    Thread Starter duelistNick

    (@duelistnick)

    That did the trick, thank you so much for the help! Reworking wp_notify_postauthor now, also.

    I had been crawling through the source code and API documentation for weeks trying to get it to work. Can’t thank you enough!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem hiding IP/Email from users in Multisite’ is closed to new replies.