PHP code example of wp-pay-extensions / gravityforms
1. Go to this page and download the library: Download wp-pay-extensions/gravityforms library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wp-pay-extensions / gravityforms example snippets
add_action( 'gform_ideal_fulfillment', 'your_function_name', 10, 2 );
/**
* Gravity Forms iDEAL fulfillment hook.
*
* @see https://github.com/wp-pay-extensions/gravityforms/blob/1.6.4/src/Extension.php#L750-L751
* @param array $entry
* @param Pronamic_WP_Pay_Extensions_GravityForms_PayFeed $feed
*/
function custom_gform_ideal_fulfillment( $entry, $feed ) {
$payment_id = gform_get_meta( $entry['id'], 'pronamic_payment_id' );
$payment = get_pronamic_payment( $payment_id );
error_log( print_r( $payment, true ) );
}
add_action( 'gform_ideal_fulfillment', 'custom_gform_ideal_fulfillment', 10, 2 );
/**
* Gravity Forms iDEAL fulfillment hook.
*
* @see https://github.com/wp-pay-extensions/gravityforms/blob/1.6.4/src/Extension.php#L750-L751
* @param array $entry
* @param Pronamic_WP_Pay_Extensions_GravityForms_PayFeed $feed
*/
function gform_ideal_fulfillment_update_entry( $entry, $feed ) {
$field_id = '';
$entry[ $field_id ] = 'New value';
GFAPI::update_entry( $entry );
}
add_action( 'gform_ideal_fulfillment', 'gform_ideal_fulfillment_update_entry', 10, 2 );
add_filter( 'pronamic_pay_gravityforms_delay_actions', 'your_function_name' );
/**
* Filter Pronamic Pay delay actions for Gravity Forms.
*
* @link https://gist.github.com/rvdsteege/6b0afe10f81b1bc99d335ff484206fa9
*/
\add_filter( 'pronamic_pay_gravityforms_delay_actions', function( $delay_actions ) {
$delay_actions['gp_unique_id'] = array(
'active' => true,
'meta_key' => '_pronamic_pay_gf_delay_gp_unique_id',
'delayed_payment_integration' => false,
'label' => \__( 'Wait for payment to create a Gravity Perks Unique ID.', 'text-domain' ),
'delay_callback' => function() {
\add_filter( 'gpui_wait_for_payment', function( $enabled ) {
$enabled = true;
return $enabled;
} );
\add_filter( 'gpui_wait_for_payment_feed', function( $feed, $form, $entry ) {
if ( class_exists( '\Pronamic\WordPress\Pay\Extensions\GravityForms\FeedsDB' ) ) {
$feed = \Pronamic\WordPress\Pay\Extensions\GravityForms\FeedsDB::get_feed_by_entry_id( $entry['id'] );
if ( null === $feed ) {
$feeds = \Pronamic\WordPress\Pay\Extensions\GravityForms\FeedsDB::get_active_feeds_by_form_id( $entry['form_id'] );
$feed = array_shift( $feeds );
}
}
return $feed;
} );
},
'process_callback' => function( $entry, $form ) {
\gp_unique_id_field()->populate_field_value( $entry, $form, true );
}
);
return $delay_actions;
} );