$billing_label = 'Billing Account Info';
break;
case 'Pending':
- $billing_link = 'glm_action=billing&member=' . $memberID . '&option=renew';
- $billing_label = 'Renewal Membership';
+ // If they're pending check if they have an unpaid renewal invoice created.
+ $invoice_id = $this->wpdb->get_var(
+ $this->wpdb->prepare(
+ "SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices
+ WHERE account = %d
+ AND paid <> true
+ AND renewal = true",
+ $accountID
+ )
+ );
+ if ( $invoice_id ) {
+ $billing_link = 'glm_action=billing&member=' . $memberID . '&option=makepayment';
+ $billing_label = 'Pay Invoice';
+ } else {
+ $billing_link = 'glm_action=billing&member=' . $memberID . '&option=renew';
+ $billing_label = 'Renewal Membership';
+ }
break;
case 'Expired':
$billing_link = 'glm_action=billing&member=' . $memberID . '&option=renew';