Log IP addresses of forum users
Posted by Simon Goodchild at June 8th, 2012
Add the following to your themes functions.php file to create a file called IP_forumposts.log that will track the IP addresses of those posting and replying on your forum.
function newtopic_hook_for_ip($uid, $user_name, $uid, $post, $forum, $new_tid) {
$mutex = @fopen(WP_PLUGIN_DIR . '/IP_forumposts.log', 'a');
fwrite ( $mutex, date("d m Y - H:i:s", time())." - new topic by ".$user_name." - ID ".$uid." - IP ".$_SERVER['REMOTE_ADDR']."\r\n");
fwrite ( $mutex, "");
fclose ( $mutex );
}
add_action('symposium_forum_newtopic_hook', 'newtopic_hook_for_ip', 10, 6);
function reply_hook_for_ip($uid, $user_name, $tid) {
$mutex = @fopen(WP_PLUGIN_DIR . '/IP_forumposts.log', 'a');
fwrite ( $mutex, date("d m Y - H:i:s", time())." - new reply from ".$user_name." - ID ".$uid." - IP ".$_SERVER['REMOTE_ADDR']."\r\n");
fwrite ( $mutex, "");
fclose ( $mutex );
}
add_action('symposium_forum_reply_hook', 'reply_hook_for_ip', 10, 3);
Category: Tips and Tricks
Post Tagged with forum 



Saving...
Leave a Reply