Add primary performance and preset color schemes

This commit is contained in:
Brian Miyaji
2015-03-03 17:15:13 +11:00
parent 47b8e144e8
commit ca0751d9d2
4 changed files with 108 additions and 26 deletions

View File

@@ -19,6 +19,7 @@ class SP_Admin_AJAX {
*/
public function __construct() {
add_action( 'wp_ajax_sp-save-primary-result', array( $this, 'save_primary_result' ), 1 );
add_action( 'wp_ajax_sp-save-primary-performance', array( $this, 'save_primary_performance' ), 1 );
add_action( 'wp_ajax_sp-save-inline-results', array( $this, 'save_inline_results' ) );
}
@@ -36,6 +37,20 @@ class SP_Admin_AJAX {
wp_send_json_success();
}
/**
* Auto-save the selected primary performance.
*
* @since 1.7
*/
function save_primary_performance() {
check_ajax_referer( 'sp-save-primary-performance', 'nonce' );
$primary_performance = sanitize_key( $_POST['primary_performance'] );
update_option( 'sportspress_primary_performance', $primary_performance );
wp_send_json_success();
}
/**
* Save event results inline.
*