Skip to content

Instantly share code, notes, and snippets.

@remcotolsma
Last active August 18, 2021 14:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remcotolsma/9738e8830764b4e517565e920dffd893 to your computer and use it in GitHub Desktop.
Save remcotolsma/9738e8830764b4e517565e920dffd893 to your computer and use it in GitHub Desktop.
Extend Formidable Forms entries list with Pronamic Pay payment info/status.
<?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