Last active
August 18, 2021 14:30
-
-
Save remcotolsma/9738e8830764b4e517565e920dffd893 to your computer and use it in GitHub Desktop.
Extend Formidable Forms entries list with Pronamic Pay payment info/status.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Formidable Forms. | |
* | |
* @link https://github.com/Strategy11/formidable-forms/blob/v5.0.01/classes/controllers/FrmEntriesController.php#L31 | |
* @link https://github.com/Strategy11/formidable-forms/blob/v5.0.01/classes/helpers/FrmEntriesListHelper.php#L289-L293 | |
*/ | |
$screen = 'formidable_page_formidable-entries'; | |
\add_filter( 'manage_' . $screen . '_columns', function( $columns ) { | |
$columns['pronamic_payment_status'] = __( 'Pronamic Payment Status', 'your-text-domain' ); | |
return $columns; | |
}, 20 ); | |
$column_name = 'pronamic_payment_status'; | |
\add_filter( 'frm_entries_' . $column_name . '_column', function( $value, $data ) { | |
if ( ! \array_key_exists( 'item', $data ) ) { | |
return $value; | |
} | |
$item = $data['item']; | |
$payment = \reset( \get_pronamic_payments_by_source( 'formidable-forms', $item->id ) ); | |
if ( false === $payment ) { | |
return; | |
} | |
return \print_r( $payment, true ); | |
}, 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment