Skip to content

Commit

Permalink
Added create_column method for installing properly #496
Browse files Browse the repository at this point in the history
Minor style adjustments
  • Loading branch information
Devin Walker committed Mar 26, 2016
1 parent 474d6bb commit 367cc03
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion assets/js/frontend/give.all.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/scss/frontend/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ Notices, Warnings & Errors
color: #FFF;
width: 30px;
height: 30px;
font-size:16px;
border-radius: 100%;
text-align: center;
line-height: 30px;
Expand Down Expand Up @@ -582,6 +583,7 @@ form[id*='give-form'] {
font-style: italic;
line-height: 20px;
font-size: 16px;
font-weight:normal;

&.give-updating-price-loader {
float: left;
Expand Down
2 changes: 1 addition & 1 deletion assets/sourcemaps/give.css.map

Large diffs are not rendered by default.

28 changes: 27 additions & 1 deletion includes/class-give-no-logins.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ function init() {
$is_enabled = give_get_option( 'email_access' );

//Non-logged in users only
if ( is_user_logged_in() || $is_enabled !== 'on' ) {
if ( is_user_logged_in() || $is_enabled !== 'on' || is_admin() ) {
return;
}

//Are db columns setup?
$is_setup = give_get_option( 'email_access_installed' );
if ( empty( $is_setup ) ) {
$this->create_columns();
}

// Timeouts
$this->verify_throttle = apply_filters( 'give_nl_verify_throttle', 300 );
$this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 );
Expand Down Expand Up @@ -280,4 +286,24 @@ function users_purchases_args( $args ) {
}


/**
* Create Columns
*
* @description Create the necessary columns for email access
*/
function create_columns() {

global $wpdb;

//Create columns in customers table
$query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`");

//Columns added properly
if($query) {
give_update_option( 'email_access_installed', 1 );
}

}


}
4 changes: 3 additions & 1 deletion templates/give.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion templates/give.min.css

Large diffs are not rendered by default.

0 comments on commit 367cc03

Please sign in to comment.