We call this method to set a given user in the given i2b2 project. For this example, we will default the status to A for active and default the password to temp.

function i2b2_set_user($user_name, $full_name, $email, $status, $password){
	global $i2b2_pm_uri, $i2b2_domain, $i2b2_service_account_id, $i2b2_service_account_pw;
	
	$request_xml = i2b2_header_xml($i2b2_pm_uri, $i2b2_domain, $i2b2_service_account_id, $i2b2_service_account_pw);
	$request_xml .= "<pm:set_user>";
	$request_xml .= "	<user_name>$user_name</user_name>";
	$request_xml .= "	<full_name>$full_name</full_name>";
	$request_xml .= "	<email>$email</email>";
	$request_xml .= "	<status_cd>A</status_cd>";
	$request_xml .= "	<password>temp</password>";
	$request_xml .= "</pm:set_user>";
	$request_xml .= i2b2_footer_xml();
	
	$ch = curl_init($i2b2_pm_uri);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
	curl_setopt($ch, CURLOPT_POSTFIELDS, "$request_xml");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$data = curl_exec($ch);
	
	log_request($request_xml, $user_name . '-' . __FUNCTION__);
	
	return $data;
		 
}