redbox
Member
Posted 16 years ago #
I'm only able to find IP addresses of commenters. What about a new blogger? I don't see a place to log IP address in their user profile or blog info. This could be really helpful in blocking repeat spammers.
I know I could check the server logs, but many websites are so high traffic that the logs are pretty massive. It would be nice to have a quick and easy way to view them. Am I overlooking something?
Thanks :)
lunabyte
Member
Posted 16 years ago #
Look in the registration table.
redbox
Member
Posted 16 years ago #
Thanks for the reply. It would be nice to have this displayed somewhere in the site admin, so we don't have to use phpmyadmin to find it. Maybe I'll add it to the requests forum :)
Add something like this to mu-plugins:
function get_blog_registration_ip () {
global $wpdb;
global $blog;
$ip = $wpdb->get_var( "SELECT IP FROM {$wpdb->registration_log} WHERE blog_id = ".$blog[ 'blog_id' ]."" );
?>
IP: <strong><?php echo $ip; ?></strong>
<?php
}
add_action('wpmublogsaction', 'get_blog_registration_ip' );
?>
Look for it under Actions in wpmu-blogs.php
dsader, I'm not sure what you mean by add it to mu-plugins, can you explain?
will this allow you to see the IP through the site admin?
thanks
shmooth
Member
Posted 15 years ago #
'mu-plugins' refers to:
[your_wpmu_base_install_dir]\wp-content\mu-plugins
basically, it's the 'plugins' directory for wpmu, whereas the 'regular' wp 'plugins' directory is just called 'plugins'.
si?
:)
lunabyte
Member
Posted 15 years ago #
No, not si.
Plugins still go in /plugins/, but on a rare occasion there may be a very special file or plugin that absolutely has to be run on every page, of every site, every time. Like maybe an action added to wp_footer, for example. In those rare cases, you can put it in mu-plugins and it will automatically be loaded every single page, for every single blog.
Use mu-plugins sparingly.