Skip to content

Instantly share code, notes, and snippets.

View rvdsteege's full-sized avatar

Reüel van der Steege rvdsteege

View GitHub Profile
@rvdsteege
rvdsteege / pronamic-pay-payment-description-tags.php
Created May 11, 2023 13:02
Custom payment description tags with Pronamic Pay.
<?php
/**
* Pronamic Pay payment description tags.
*
* @param \Pronamic\WordPress\Pay\Payments\Payment $payment $payment Payment.
* @return void
*/
function pronamic_pay_description_tags( $payment ) {
// Customer.
@rvdsteege
rvdsteege / pronamic-pay-formidable-forms-update-entry-payment-status.php
Last active April 16, 2024 10:17
Update Formidable Forms field in entry when payment status of a Pronamic Pay payment is updated.
<?php
/**
* Update Formidable Forms field in entry when payment status of a Pronamic Pay payment is updated.
*/
add_action( 'pronamic_payment_status_update_formidable-forms', 'pronamic_pay_update_formidable_forms_entry_payment_status' );
function pronamic_pay_update_formidable_forms_entry_payment_status( $payment ) {
/**
* Form fields to update with payment status.
@rvdsteege
rvdsteege / pronamic-pay-gform-ideal-fulfillment-update-entry.php
Last active January 27, 2022 09:30
Update Gravity Forms entry with payment details on successful payment.
<?php
function gform_ideal_fulfillment_update_entry( $entry, $feed ) {
// Check entry fulfillment.
if ( '1' !== $entry['is_fulfilled'] ) {
return;
}
// Get Pronamic payment.
$payment_id = gform_get_meta( $entry['id'], 'pronamic_payment_id' );
@rvdsteege
rvdsteege / pronamic-pay-rcp-payment-methods-order.php
Last active November 12, 2021 08:31
Order payments gateways in Restrict Content Pro. Add WordPress filter to for example the `functions.php` file of your WordPress theme.
<?php
function pronamic_pay_rcp_payment_methods_order( $gateways ) {
/*
* Gateways in preferred order.
*
* @link https://github.com/wp-pay-extensions/restrict-content-pro/blob/3.0.0/src/Extension.php#L201-L242
*/
$order = array(
'pronamic_pay_direct_debit_bancontact',
@rvdsteege
rvdsteege / sg-cachepress-fix-timeout-menu-save.php
Created July 27, 2021 12:46
Fix timeout when menus are saved when Automatic Cache Purging of SG Optimizer plugin is enabled. Add code to `functions.php` of your WordPress theme.
<?php
/**
* Prevent timeout when menus are saved when Automatic Cache Purging of SG Optimizer plugin is enabled.
*/
add_action( 'save_post_nav_menu_item', 'sg_cachepress_remove_purge_all_post_cache' );
function sg_cachepress_remove_purge_all_post_cache() {
global $wp_filter;
@rvdsteege
rvdsteege / memberpress-prevent-duplicate-payment.php
Last active July 22, 2021 12:35
MemberPress does not have anti double click on the `#payment-form` submit button, which can result in duplicate payments/subscriptions with the Pronamic Pay plugin. This can be fixed by adding this gist to the `functions.php` file of the WordPress theme.
<?php
/**
* Prevent double click on MemberPress payment form (#payment-form).
*
* @return void
*/
add_action( 'wp_footer', 'memberpress_prevent_duplicate_payment' );
function memberpress_prevent_duplicate_payment() {
@rvdsteege
rvdsteege / pronamic-pay-auto-complete-recurring-payment-within-period.php
Last active January 17, 2022 09:28
Auto complete Pronamic Pay recurring payments within given period.
<?php
// Add below code to the functions.php file of your WordPress theme and set date range in `$auto_complete_period`.
/**
* Pronamic Pay auto complete recurring payments within period.
*/
add_filter( 'wp_insert_post_data', 'pronamic_pay_recurring_payment_zero_amount', 9, 2 );
function pronamic_pay_recurring_payment_zero_amount( $data, $postarr ) {
/*
@rvdsteege
rvdsteege / pronamic-pay-gravity-forms-2nd-confirmation-successful-payment.php
Created April 21, 2021 12:53
Pronamic Pay 2nd confirmation in Gravity Forms for successful payment based on entry values
/**
* Gravity Forms successful payment confirmation based on entry.
*/
add_filter( 'gform_confirmation', 'pronamic_gform_confirmation', 10, 4 );
function burometa_gform_confirmation( $confirmation, $form, $entry, $ajax ) {
// Setup.
$field_id = 14;
$field_value = 'recurring';
$custom_confirmation_id = '5c1b68379fc8x';
@rvdsteege
rvdsteege / update-memberpress-transaction-with-pronamic-pay-transaction-id.php
Created March 19, 2021 15:00
Update MemberPress transaction number with Pronamic Pay transaction ID
<?php
/**
* Update MemberPress transaction number.
*
* @param \Pronamic\WordPress\Pay\Payments\Payment $payment Payment.
* @retun void
*/
function update_mepr_transaction_number( $payment ) {
// Check payment source.
@rvdsteege
rvdsteege / woocommerce-order-cancel-on-canceled-payment.php
Created November 27, 2020 14:15
Cancel WooCommerce order on cancelled Pronamic Pay payment.
<?php
add_action( 'pronamic_payment_status_update', 'pronamic_pay_wc_order_cancel', 15 );
/**
* Cancel WooCommerce order on cancelled Pronamic Pay payment.
*
* @param Payment $payment Payment.
* @return void
*/