Democracy Plugin and HTTP Proxy
-
In order to speed up my site, I’ve implemented Varnish to help. However, there’s a problem with my Democracy plugin, since I have it logging IP addresses to prevent poll-hogging.
The way the server handles IP addresses is different now. I had to patch my comment.php file in order to show the proper user IP address when a comment is made.
However, the Democracy plugin now stops after one vote has been submitted (because it thinks every user is on the same IP address).
This is the patch a consultant helped me on the user side, can anyone help me patch the Democracy plugin to again allow votes from more than the first user to vote?
Please advise.
— wp-includes/comment.php (revisión: 39)
+++ wp-includes/comment.php (copia de trabajo)
@@ -384,7 +384,20 @@
$commentdata[‘user_ID’] = (int) $commentdata[‘user_ID’];$commentdata[‘comment_author_IP’] = preg_replace( ‘/[^0-9., ]/’, ”,$_SERVER[‘REMOTE_ADDR’] );
– $commentdata[‘comment_agent’] = $_SERVER[‘HTTP_USER_AGENT’];
+ if ($commentdata[‘comment_author_IP’] == “127.0.0.1”) {
+ foreach ( array(
+ “HTTP_CLIENT_IP”,
+ “HTTP_X_FORWARDED_FOR”,
+ “HTTP_X_FORWARDED”,
+ “HTTP_FORWARDED_FOR”,
+ “HTTP_FORWARDED”,
+ “REMOTE_ADDR”) as $addrtype ) {
+ if (!isset($_SERVER[$addrtype])) { continue; }
+ $commentdata[‘comment_author_IP’] = preg_replace( ‘/[^0-9., ]/’, ”,$_SERVER[$addrtype] );
+ if ($commentdata[‘comment_author_IP’]) break;
+ }
+ }
+ $commentdata[‘comment_agent’] = $_SERVER[‘HTTP_USER_AGENT’];$commentdata[‘comment_date’] = current_time(‘mysql’);
$commentdata[‘comment_date_gmt’] = current_time(‘mysql’, 1);
The topic ‘Democracy Plugin and HTTP Proxy’ is closed to new replies.