);
} else {
// Get the member name
- $member_name = $this->wpdb->get_var( "SELECT name FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "members WHERE id = $member_id" );
+ $member_name = $this->wpdb->get_var( "SELECT name FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "members WHERE id = $member_id" );
+ $invoice_type = 0;
+ $current_member_type = $this->wpdb->get_var(
+ $this->wpdb->prepare(
+ "SELECT member_type
+ FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members
+ WHERE id = %d",
+ $member_id
+ )
+ );
+ if ( $current_member_type ) {
+ $invoice_type = $this->wpdb->get_var(
+ $this->wpdb->prepare(
+ "SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoice_types
+ WHERE member_type = %d",
+ $current_member_type
+ )
+ );
+ }
// Need to create an account record
$billing_updated['ref_name'] = $member_name; // Use members name
$billing_updated['ref_dest'] = $member_id;
$billing_updated['anniversary_date'] = date('Y-m-d H:i:s');
+ $billing_updated['invoice_type'] = $invoice_type;
$billing_updated_format[] = '%s';
$billing_updated_format[] = '%d';
$billing_updated_format[] = '%s';
+ $billing_updated_format[] = '%d';
$this->wpdb->insert(
GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'accounts',
$billing_updated,
* Plugin Name: GLM Members Billing
* Plugin URI: http://www.gaslightmedia.com/
* Description: This is glmAssociate Billing Module
- * Version: 1.0.27
+ * Version: 1.0.28
* Author: Gaslight Media
* Author URI: http://www.gaslightmedia.com/
* License: GPL2
* @package glmMembersBillingAddOn
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0.27
+ * @version 1.0.28
*/
/*
* so that we're sure the other add-ons see an up to date
* version from this plugin.
*/
-define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '1.0.27');
+define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '1.0.28');
define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.26');
// This is the minimum version of the GLM Members DB plugin require for this plugin.