Put your tips and tricks online - Share your knowledge! Login | Register
 
 
  Search     Advanced search
 

Home | Ask Question | Add tip | My tips | Recent tips & tricks | Suggest a category | FAQ | Forums

 
 
 
 Category : Home > Internet > CMS > Wordpress     

Hide IP addresses in comments using user_level variable


In current version of Wordpress (2.0.5) IP and e-mail address of poster are displayed to other
registered users (not only the poster of comment but anybody who's logged in). This
customization will hide IP address and email. Edit file wp-admin/edit-comments.php and place
this line somewhere at the top, with other PHP code:

<?php

	global $user_level;

	//
	// Permission level + 1 who can see the posters' IP and E-mail
	//
	$allowed_user_level = 3;

?>

Then find this line:

                <p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if
($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php
comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' !=
$comment->comment_author_url ) { ?> | <strong><?php _e('URI:') ?></strong> <?php
comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a
href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php
comment_author_IP() ?></a></p>

and replace with:

        <p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if
($user_level > $allowed_user_level && $comment->comment_author_email) { ?>| <strong><?php
_e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if
($comment->comment_author_url && 'http://' != $comment->comment_author_url ) { ?> |
<strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } if
($user_level > $allowed_user_level) { ?>| <strong><?php _e('IP:') ?></strong> <a
href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php
comment_author_IP(); } ?></a></p>

That's it. The IP and e-mail of poster will be hidden from users with user_level below 3.


  Options
 
   del.icio.us  |  newsvine  |  digg  |  furl  |  google  |  yahoo  |  Ma.gnolia  |  vigillar  |  reddit  |  technorati  |  icerocket  |  pubsub

     (Average: 5 / Votes: 1)   Rate this tip:    

  Details
Tip reference : #145
views : 1231
Added on : 11/16/06
Submited by : h8dk97
 
Send a message Send a message Printer friendly output Printer friendly output
Display this member's tips Display this member's tips (163)
 
 
 Most viewed tips 
  Databases > Oracle > Security : How to unlock Oracle user account  
  Operating Systems > Unix : How to kill Unix user session  
  Databases > Oracle > Performance Tuning : How to enable trace in Oracle  
  Databases > Oracle : Kill user session  
   
  All categories
Databases | Programming | Hardware | Operating Systems | Networking | Internet | ERP / CRM | Games & Multimedia | Graphics & Design | Miscellaneous | Office Software | TipLib FAQ
 
 

Home |  FAQ |  Terms of Use |  Privacy Policy

© 2005 tiplib.com