WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [plugin:Commenter Email] How to Display all commenters ?? (2 posts)

  1. viky081
    Member
    Posted 1 year ago #

    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!

  2. viky081
    Member
    Posted 1 year ago #

    Fixed...

Topic Closed

This topic has been closed to new replies.

About this Topic