Last active
August 29, 2015 13:56
-
-
Save wpweb101/ea597189a5a075911602 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_activation_hook( __FILE__, 'edd_points_install' ); | |
function edd_points_install() { | |
global $wpdb, $edd_options; | |
$udpopt = false; | |
//check earning points conversion not set | |
if( !isset( $edd_options['edd_points_earn_conversion'] ) ) { | |
$edd_options['edd_points_earn_conversion'] = array( 'points' => __( '1', 'eddpoints' ), 'rate' => __( '1', 'eddpoints' ) ); | |
$udpopt = true; | |
}//end if | |
//check redeem conversion is not set | |
if( !isset( $edd_options['edd_points_redeem_conversion'] ) ) { | |
$edd_options['edd_points_redeem_conversion'] = array( 'points' => __( '100', 'eddpoints' ), 'rate' => __( '1', 'eddpoints' ) ); | |
$udpopt = true; | |
} //end if | |
//check cart maximum discount is not set | |
if( !isset( $edd_options['edd_points_cart_max_discount'] ) ) { | |
$edd_options['edd_points_cart_max_discount'] = ''; | |
$udpopt = true; | |
} //end if | |
//check need to update the defaults value to options | |
if( $udpopt == true ) { // if any of the settings need to be updated | |
update_option( 'edd_settings', $edd_options ); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment