<?php
add_filter('ninja_forms_render_options','ninja_forms_pre_population_callback_rest_api', 10, 2);
function ninja_forms_pre_population_callback_rest_api($options, $settings) {
	if( $settings['key'] == 'restapi-delete-user-select-email' ) {
		global $wpdb;	
		$rows = $wpdb->get_results("
									Select
										wp_hq.wp_users.user_email,
										wp_hq.wp_6_mepr_members.user_id
									From
										wp_hq.wp_users Inner Join
										wp_hq.wp_6_mepr_members On wp_hq.wp_users.ID = wp_hq.wp_6_mepr_members.user_id
									Order By
										wp_hq.wp_users.user_email
								  	", OBJECT );		
			
		foreach ($rows as $obj) :		
			if ($obj->user_id == 1) {
				next();
			}
			else {			
				array_push($options, array('label' => $obj->user_email, 'value' => $obj->user_id));
			}			
		endforeach;		
	}
	return $options;
}