Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function format_post_data( $post_data ) {
- if ( isset( $post_data['contact_id'] ) ) {
- return $post_data;
- }
- $defaults = array(
- 'notify' => false,
- 'role' => false
- );
- $post_data = array_merge( $defaults, $post_data );
- $xml = simplexml_load_string( file_get_contents( 'php://input' ) );
- $data = $xml->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children('http://soap.sforce.com/2005/09/outbound')->notifications;
- $notifications_count = count( $data->Notification );
- if ( $notifications_count > 1 ) {
- wp_fusion()->batch->includes();
- wp_fusion()->batch->init();
- }
- $key = 0;
- while ( $key !== $notifications_count ) {
- $contact_id = (string) $data->Notification[$key]->sObject->children('urn:sobject.enterprise.soap.sforce.com')->Id;
- $post_data['contact_id'] = $contact_id;
- if ( $key == 0 ) {
- continue;
- } else {
- wp_fusion()->batch->process->push_to_queue( array( 'action' => 'wpf_batch_import_users', 'args' => array( $post_data['contact_id'], $post_data ) ) );
- }
- $key++;
- }
- if ( $notifications_count > 1 ) {
- wp_fusion()->batch->process->save()->dispatch();
- }
- return $post_data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement