LLMS_Admin_Setup_Wizard::save()
Handle saving data during setup
Description Description
Return Return
(void)
Source Source
File: includes/admin/class.llms.admin.setup.wizard.php
public function save() { if ( ! isset( $_POST['llms_setup_nonce'] ) || ! wp_verify_nonce( $_POST['llms_setup_nonce'], 'llms_setup_save' ) || empty( $_POST['llms_setup_save'] ) ) { return; } switch ( $_POST['llms_setup_save'] ) { case 'coupon': update_option( 'llms_allow_tracking', 'yes' ); $req = LLMS_Tracker::send_data( true ); if ( is_wp_error( $req ) ) { $r = false; } elseif ( isset( $req['success'] ) ) { $r = $req['success']; if ( ! $req['success'] ) { $this->error = new WP_Error( 'error', $r['message'] ); return; } } break; case 'finish': add_filter( 'llms_generator_course_status', array( $this, 'generator_course_status' ) ); $json = file_get_contents( 'http://d34dpc7391qduo.cloudfront.net/sample-content/llms-sample-course.json' ); $gen = new LLMS_Generator( $json ); $gen->set_generator(); $gen->generate(); if ( $gen->is_error() ) { wp_die( $gen->get_results() ); } else { $courses = wp_get_recent_posts( array( 'numberposts' => 1, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'course', 'post_status' => 'publish', 'suppress_filters' => true, ) ); if ( $courses ) { wp_safe_redirect( get_edit_post_link( $courses[0]['ID'], 'not-display' ) ); die; } } break; case 'pages': $r = LLMS_Install::create_pages(); break; case 'payments': $country = isset( $_POST['country'] ) ? sanitize_text_field( $_POST['country'] ) : get_lifterlms_country(); update_option( 'lifterlms_country', $country ); $currency = isset( $_POST['currency'] ) ? sanitize_text_field( $_POST['currency'] ) : get_lifterlms_currency(); update_option( 'lifterlms_currency', $currency ); $manual = isset( $_POST['manual_payments'] ) ? sanitize_text_field( $_POST['manual_payments'] ) : 'no'; update_option( 'llms_gateway_manual_enabled', $manual ); $r = true; break; default: $r = false; break; }// End switch(). if ( false === $r ) { $this->error = new WP_Error( 'error', __( 'There was an error saving your data, please try again.', 'lifterlms' ) ); return; } else { wp_safe_redirect( $this->get_step_url( $this->get_next_step() ) ); exit; } }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: