Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active August 22, 2016 15:55
A function that can be used to display all payment method within Event Espresso -> Payment Methods. This will show 'Admin Only' payment methods in the same way as standard which allows you to alter the strings used within.
<?php
/*
Plugin Name: Event Espresso site specific functions
Description: Add custom functions for Event Espresso to this plugin.
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
//This function shows all payment methods within Event Espresso -> Payment Methods.
function tw_ee_display_admin_only_pms( $payment_methods ) {
//Pull all of the payment methods from the DB, including Admin only pm's.
$all_payment_methods = EEM_Payment_Method::instance()->get_all();
//Setup an array to hold all of the payment methods from the DB.
$new_payment_methods = array();
//Loop through all of the payment methods and add them to the new array.
foreach ( $all_payment_methods as $payment_method ) {
$new_payment_methods[ $payment_method->slug() ] = $payment_method;
}
//This will include all current and past payment methods that have been uused within EE.
return $new_payment_methods;
}
add_filter( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', 'tw_ee_display_admin_only_pms' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment