Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter sniemans

    (@sniemans)

    Hi all,

    Thank you for the swift responses and suggestions thus far. I slightly modified the snippet suggested by Petra/Indigo to the following:

    
    add_filter( 'gform_mollie_return_url', 'set_mollie_return_url', 10, 4 );
    function set_mollie_return_url( $url, $form_id, $lead_id, $query ) {
    	$pageURL   = GFCommon::is_ssl() ? 'https//' : 'https://';
    	$pageURL   .= $_SERVER['HTTP_HOST'] . parse_url( $_SERVER["REQUEST_URI"], PHP_URL_PATH );
    	$ids_query = 'ids=' . $form_id . '|' . $lead_id;
    	$ids_query .= '&hash=' . wp_hash( $ids_query );
    
    	$url = add_query_arg( 'gf_mollie_return', base64_encode( $ids_query ), $pageURL );
    
    	return $url;
    }
    

    In my situation, the user may arrive at the form with some query string parameters that can be used to pre-populate fields. This would cause the return parameters to break (because there would be a missing ‘&’ before it). The solution was to first ‘parse_url’ with ‘PHP_URL_PATH’.

    After that, it was smooth sailing and all my issues seem to have been resolved. Thanks again!

Viewing 1 replies (of 1 total)