update to bootstrap 4 p1, bugfix for logoLarge, logging cleanup, more
This commit is contained in:
@ -67,7 +67,7 @@ class MembershipCustomers extends DatabaseModel {
|
||||
|
||||
$api_key = Config::getValue( 'memberships/stripeSecret' );
|
||||
if ( $api_key == 'sk_xxxxxxxxxxxxxxx' || empty($api_key) ) {
|
||||
Debug::error( "No Stripe Key found" );
|
||||
Debug::error( "MembershipCustomers:create No Stripe Key found" );
|
||||
return false;
|
||||
}
|
||||
self::$stripe = new \Stripe\StripeClient( $api_key );
|
||||
|
@ -22,6 +22,7 @@ use TheTempusProject\Bedrock\Classes\Config;
|
||||
|
||||
class MembershipProducts extends DatabaseModel {
|
||||
public static $stripe;
|
||||
private static $loaded = false;
|
||||
public $tableName = 'membership_products';
|
||||
public $databaseMatrix = [
|
||||
[ 'name', 'varchar', '128' ],
|
||||
@ -35,11 +36,14 @@ class MembershipProducts extends DatabaseModel {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$api_key = Config::getValue( 'memberships/stripeSecret' );
|
||||
if ( $api_key == 'sk_xxxxxxxxxxxxxxx' || empty($api_key) ) {
|
||||
Debug::error( "No Stripe Key found" );
|
||||
} else {
|
||||
self::$stripe = new \Stripe\StripeClient( $api_key );
|
||||
if ( ! self::$loaded ) {
|
||||
$api_key = Config::getValue( 'memberships/stripeSecret' );
|
||||
if ( $api_key == 'sk_xxxxxxxxxxxxxxx' || empty($api_key) ) {
|
||||
Debug::error( "MembershipProducts:__construct No Stripe Key found" );
|
||||
} else {
|
||||
self::$stripe = new \Stripe\StripeClient( $api_key );
|
||||
}
|
||||
self::$loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ use TheTempusProject\Canary\Classes\CustomException;
|
||||
class Memberships extends DatabaseModel {
|
||||
public static $stripe;
|
||||
public static $products;
|
||||
private static $loaded = false;
|
||||
public $tableName = 'membership_records';
|
||||
public $databaseMatrix = [
|
||||
[ 'stripe_customer', 'varchar', '64' ],
|
||||
@ -38,12 +39,15 @@ class Memberships extends DatabaseModel {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
self::$products = new MembershipProducts;
|
||||
$api_key = Config::getValue( 'memberships/stripeSecret' );
|
||||
if ( $api_key == 'sk_xxxxxxxxxxxxxxx' || empty($api_key) ) {
|
||||
Debug::error( "No Stripe Key found" );
|
||||
} else {
|
||||
self::$stripe = new \Stripe\StripeClient( $api_key );
|
||||
if ( ! self::$loaded ) {
|
||||
self::$products = new MembershipProducts;
|
||||
$api_key = Config::getValue( 'memberships/stripeSecret' );
|
||||
if ( $api_key == 'sk_xxxxxxxxxxxxxxx' || empty($api_key) ) {
|
||||
Debug::error( "Memberships:__construct No Stripe Key found" );
|
||||
} else {
|
||||
self::$stripe = new \Stripe\StripeClient( $api_key );
|
||||
}
|
||||
self::$loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,9 +83,9 @@ class Memberships extends DatabaseModel {
|
||||
public function getUserSubs( $limit = null ) {
|
||||
$whereClause = ['local_user_id', '=', App::$activeUser->ID ];
|
||||
if ( empty( $limit ) ) {
|
||||
$postData = self::$db->getPaginated( $this->tableName, $whereClause );
|
||||
$postData = self::$db->get( $this->tableName, $whereClause );
|
||||
} else {
|
||||
$postData = self::$db->getPaginated( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
|
||||
$postData = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
|
||||
}
|
||||
if ( !$postData->count() ) {
|
||||
Debug::info( 'No user subs found.' );
|
||||
|
Reference in New Issue
Block a user