Quantcast
Channel: Topic Tag: plugin | WordPress.org
Viewing all articles
Browse latest Browse all 26892

viky081 on "[plugin:Commenter Email] How to Display all commenters ??"

$
0
0

I modified the Plugin Of commenter Email,I have a commenters data of about 54, But they display only 11! I really confuse what i did
here is the mysql code of wordpress plugin, I need to display all the commenters emails(blank email also ) here is the code

public static function get_emails( $fields = array( 'comment_author_email', 'comment_author','comment_author_IP'), $output = ARRAY_N ) {
		global $wpdb;

		// comment_author_email must be one of the fields
		if ( ! in_array( 'comment_author_email', $fields ) )
			array_unshift( $fields,  'comment_author_email' );

		$fields = implode( ', ', $fields );
		$sql = "SELECT $fields
				FROM {$wpdb->comments} t1
				INNER JOIN ( SELECT MAX(comment_author) AS author FROM {$wpdb->comments} GROUP BY comment_author_email ) t2 ON t1.comment_author = t2.author
				WHERE
					comment_approved = '1' OR
					comment_author_email != '' OR
					(comment_type = '' OR comment_type = 'comment')
				GROUP BY comment_author_email
				ORDER BY comment_author_email ASC";
		$emails = $wpdb->get_results( $sql, $output );
		return $emails;
	}

Anyone Much appreciated!


Viewing all articles
Browse latest Browse all 26892

Trending Articles