Created
July 15, 2013 04:13
-
-
Save benmay/5997456 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$email = $this->email; | |
global $wpdb; | |
- if($fix) | |
- {$fix = "comment_post_ID = $fix AND ";} | |
+ if($fix) { | |
+ $fix_comments = "comment_post_ID = $fix AND "; | |
+ $fix_postmeta = "post_ID = $fix AND "; | |
+ } | |
$email = $wpdb->escape(strtolower($email)); | |
- $subscriptions = $wpdb->get_results("SELECT comment_post_ID FROM $wpdb->comments WHERE $fix LCASE(comment_author_email) = '$email' AND comment_subscribe='Y' AND comment_approved = '1' GROUP BY comment_post_ID"); | |
+ $subscriptions = $wpdb->get_results("SELECT comment_post_ID FROM $wpdb->comments WHERE $fix_comments LCASE(comment_author_email) = '$email' AND comment_subscribe='Y' AND comment_approved = '1' GROUP BY comment_post_ID"); | |
foreach ( (array) $subscriptions as $subscription ) | |
$this->email_subscriptions[] = $subscription->comment_post_ID; | |
- $subscriptions = $wpdb->get_results("SELECT post_id FROM $wpdb->postmeta WHERE $fix meta_key = '_sg_subscribe-to-comments' AND LCASE(meta_value) = '$email' GROUP BY post_id"); | |
+ $subscriptions = $wpdb->get_results("SELECT post_id FROM $wpdb->postmeta WHERE $fix_postmeta meta_key = '_sg_subscribe-to-comments' AND LCASE(meta_value) = '$email' GROUP BY post_id"); | |
foreach ( (array) $subscriptions as $subscription) | |
$this->email_subscriptions[] = $subscription->post_id; | |
if ( is_array($this->email_subscriptions) ) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment