Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created November 17, 2020 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/dbb2b93342532c1855c9c960703abaa7 to your computer and use it in GitHub Desktop.
Save Pebblo/dbb2b93342532c1855c9c960703abaa7 to your computer and use it in GitHub Desktop.
When viewing registrations linked to a specific event a checkmark is shown on the primary registrant is the transaction is complete, this function extends that to show it on all registrants within that transaction.
<?php //Please do not include the opening PHP tag if you alreayd have one.
//This function adds the checkmark to all registrants linked to a Complete transaction. By default EE only shows a checkmark on the primary registrant.
add_filter( 'FHEE__EE_Admin_List_Table__single_row_columns__column_TXN_paid__column_content', 'checkmark_on_all_column_TXN_paid', 10, 3);
function checkmark_on_all_column_TXN_paid($content, $item, $object)
{
// If primary registrant, return whatever EE already has set.
if ($item->count() === 1) {
return $content;
}
// If not the primary registrant, pull the transaction object.
$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
// Check if the amount paid is >= total, if so return a checkmark.
if ($transaction->paid() >= $transaction->total()) {
return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
}
// Return an empty space if all else fails.
return '&nbsp;';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment