-
-
Save Shelob9/452c4d0f57033e3495fcbc012ff72129 to your computer and use it in GitHub Desktop.
Custom Autopopulate Dropdown for CalderaForms
This file contains hidden or 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
add_filter( 'caldera_forms_autopopulate_options_post_value_field', 'givewp_customer_addon_purchases', 24, 2 ); | |
function givewp_customer_addon_purchases() | |
{ | |
$current_user = wp_get_current_user(); | |
$purchases = edd_get_users_purchases($current_user->user_email, 100, false, 'any'); | |
if ( $purchases ) { | |
foreach ($purchases as $purchase) { | |
$licenses = edd_software_licensing()->get_licenses_of_purchase( $purchase->ID ); | |
$addons = array(); | |
if( $licenses ) { | |
foreach ( $licenses as $license ) { | |
$dname = edd_software_licensing()->get_download_name($license->ID); | |
$addons[] = $dname; | |
} | |
} | |
} | |
return $addons; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment