Skip to content

Instantly share code, notes, and snippets.

@eighty20results
Created February 2, 2017 00:21
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 eighty20results/02239edf07f921eecf612c91e635e8d9 to your computer and use it in GitHub Desktop.
Save eighty20results/02239edf07f921eecf612c91e635e8d9 to your computer and use it in GitHub Desktop.
Sample check of order records for a user
<?php
global $wpdb;
$records = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->pmpro_membership_orders} WHERE user_id = %d AND status = %s", $user_id, 'success' ) );
if ( $records == 1 ) {
// No previous order found
} else {
// Found old orders so member is not new
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment