Skip to content

Instantly share code, notes, and snippets.

@robertuniqid
Last active August 8, 2017 19:59
Show Gist options
  • Save robertuniqid/684a47eee190ad203c64258d7ef75e97 to your computer and use it in GitHub Desktop.
Save robertuniqid/684a47eee190ad203c64258d7ef75e97 to your computer and use it in GitHub Desktop.
Formidable WPEP Verification
<?php
$user_entries = FrmEntry::getAll( [
'form_id' => $required_form_id_any,
'user_id' => get_current_user_id(),
'parent_item_id' => 0
] );
if( empty( $user_entries ) )
return false;
foreach( $user_entries as $user_entry ) {
if( class_exists( "FrmPaymentEntry" ) ) {
if( FrmFormAction::form_has_action_type( $user_entry->form_id, 'paypal' )
|| FrmFormAction::form_has_action_type( $user_entry->form_id, 'payment' ) ) {
$payment_status = FrmPaymentEntry::get_completed_payments( $user_entry['id'] );
if( in_array( $payment_status, [ 'complete', 1 ] ) )
return true;
continue;
}
}
return true;
}
return false;// no access
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment