WPIntell

Source evidence

Sendinblue parameters types

Add-on Brevo for Gravity Forms · support · 2023-04-03T11:11:00+00:00

mixedsentiment
mediumseverity
0.79relevance
1replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

5 / 25 rows with source links

20.0% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

20 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
Bastien Martinent resolved
Hi, I have encountered an issue with sendinblue boolean parameters type on your plugin. The API awaits a boolean and you seem to send directly the value of the mapped field as a string.\ So, I added a primitive “sanitizer” to your code to cast parameters based on their type before sending them to the sendinblue api. wpconnect-gf-sendinblue/includes/hooks.php function create_sendinblue_contact_after_form_submission( $mapped_fields, $lists, $double_optin, $optin_template, $optin_redirect, $feed, $entry ) { // Force array to be an array, see https://core.trac.wordpress.org/ticket/55133. if ( ! is_array( $mapped_fields ) ) { $mapped_fields = [ $mapped_fields ]; } $api = wpconnect_gf_sib_get_api(); $email = Helpers\find_email_in_mapped_fields( $mapped_fields ); if ( is_null( $email ) ) { $response = new \WP_Error( 'no_email_found', __( 'No e-mail address found in form values.', 'wpc-gf-sib' ) ); gform_update_meta( $entry['id'], sprintf( 'sib_contact_api_response:%1$d', $feed['id'] ), $response ); return; } //cast parameters $parameters = array_combine( wp_list_pluck( $mapped_fields, 'key' ), wp_list_pluck( $mapped_fields, 'value' ) ); $attributes = $api->get_attributes(); $cast = [ "boolean" => function( $v ){ return ( $v === 'true' || $v === '1' ); } ]; foreach( $attributes as $attribute ){ if( ! isset( $attribute->name ) || ! isset( $attribute->type ) ){ continue; } if( isset( $parameters[ $attribute->name ] ) && isset( $cast[ $attribute->name ] ) && is_callable( $cast[ $attribute->type ] ) ){ $parameters[ $attribute->name ] = $cast[ $attribute->name ]( $parameters[ $attribute->name ] ); } } if ( $double_optin ) { $response = $api->create_contact_with_doubleoptin( sanitize_email( $email ), $parameters, $lists, $optin_template, $optin_redirect ); } else { $response = $api->create_contact( sanitize_email( $email ), $parameters, $lists ); } gform_update_meta( $entry['id'], sprintf( 'sib_contact_api_response:%1$d', $feed['id'] ), $response ); } Do you think adding a sanitizer for the api based on sendinblue parameters type, do you suggest another solution ? Thank you for your message. Indeed, we are aware of this use case. That’s why we are currently working on the development of a global feature to optimize data conversion. Your solution can answer your particular request but it does not answer all the requests of our customers. Today, conversions only concern particular and specific use cases and it is difficult to have a generic solution for this concern. We continue to work on this feature. Regards

Comments

1 shown
WP connect 2023-04-26T15:56:00+00:00

Thank you for your message. Indeed, we are aware of this use case. That’s why we are currently working on the development of a global feature to optimize data conversion. Your solution can answer your particular request but it does not answer all the requests of our customers. Today, conversions only concern particular and specific use cases and it is difficult to have a generic solution for this concern. We continue to work on this feature. Regards