• Resolved nix255

    (@nix255)


    Is there a way to do the exact same thing as here:
    https://www.ads-software.com/support/topic/statuspage-url-parameters/
    but with Formidable Forms? In formidable I have a redirect url set in the form settings that includes a parameter using a form field. However pronamic/mollie seem to over-ride this redirect even with the Payment Status Pages not set.
    Is there a hook I can use to change this behaviour if it’s not possible in the plugin settings?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Reüel

    (@pronamic_reuel)

    You would need to add some custom code to hook into the pronamic_payment_redirect_url_formidable-forms filter to use the success URL setting with field values as parameters from the Formidable Forms form setting. See sample code below.

    
    /**
     * Redirect successful payment to Formidable Forms form success URL.
     *
     * @return string
     */
    add_filter( 'pronamic_payment_redirect_url_formidable-forms', 'formidable_forms_payment_redirect_success_url', 10, 2 );
    
    function formidable_forms_payment_redirect_success_url( $url, $payment ) {
    	// Check if payment has been paid.
    	if ( 'Success' !== $payment->get_status() ) {
    		return $url;
    	}
    
    	// Get Formidable Forms entry and form.
    	$entry_id = $payment->get_source_id();
    
    	$entry = \FrmEntry::getOne( $entry_id );
    
    	$form = \FrmForm::getOne( $entry->form_id );
    
    	// Check if redirect success URL should be used.
    	if ( 'redirect' === $form->options['success_action'] ) {
    		$success_url = \trim( $form->options['success_url'] );
    
    		$success_url = \apply_filters( 'frm_content', $success_url, $form, $entry_id );
    	
    		$success_url = \do_shortcode( $success_url );
    	
    		// Return success URL from settings.
    		if ( ! empty( $success_url ) ) {
    			return $success_url;
    		}
    	}
    
    	// Return default URL.
    	return $url;
    }
    
    Thread Starter nix255

    (@nix255)

    Thank you for this, it works brilliantly!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add url parameter to status page with Formidable Forms’ is closed to new replies.