function save()
 {
     $settings = LPR_Admin_Settings::instance('pages');
     $section = $this->section['id'];
     if ($section == 'quiz') {
         $post_data = $_POST['lpr_settings'][$this->id];
         if ($post_data['retake_quiz'] < 0) {
             $post_data['retake_quiz'] = 0;
         }
         $settings->set('quiz', $post_data);
     } elseif ('course' == $section) {
         $post_data = $_POST['lpr_settings'][$this->id];
         if ($post_data['retake_course'] < 0) {
             $post_data['retake_course'] = 0;
         }
         $settings->set('course', $post_data);
     } else {
         $post_data = $_POST['lpr_settings'][$this->id];
         $settings->set('general', $post_data);
     }
     $settings->update();
 }
 function save()
 {
     $settings = LPR_Admin_Settings::instance('emails');
     $section = $this->section['id'];
     $post_data = $_POST['lpr_settings'][$this->id];
     $settings->set($section, $post_data);
     $settings->update();
 }
function learn_press_edit_admin_bar()
{
    global $wp_admin_bar;
    $current_user = wp_get_current_user();
    if (learn_press_has_profile_method()) {
        $course_profile = array();
        $course_profile['id'] = 'course_profile';
        $course_profile['parent'] = 'user-actions';
        $course_profile['title'] = __('View Course Profile', 'learn_press');
        $course_profile['href'] = learn_press_get_current_profile_link();
        $course_profile['meta']['target'] = '_blank';
        $wp_admin_bar->add_menu($course_profile);
    }
    // add `be teacher` link
    if (in_array('lpr_teacher', $current_user->roles) || in_array('administrator', $current_user->roles)) {
        return;
    }
    if (!class_exists('LPR_Admin_Settings')) {
        return;
    }
    $settings = LPR_Admin_Settings::instance('general');
    if ($settings->get('instructor_registration')) {
        $be_teacher = array();
        $be_teacher['id'] = 'be_teacher';
        $be_teacher['parent'] = 'user-actions';
        $be_teacher['title'] = __('Become An Instructor', 'learn_press');
        $be_teacher['href'] = '#';
        $wp_admin_bar->add_menu($be_teacher);
    }
}
 function save()
 {
     $settings = LPR_Admin_Settings::instance('general');
     // $_POST['lpr_settings']['general'];
     $settings->bind($_POST['learn_press']);
     $settings->update();
 }
 function learn_press_admin_settings($key)
 {
     return LPR_Admin_Settings::instance($key);
 }
 function save()
 {
     $settings = LPR_Admin_Settings::instance('payment');
     $section = $this->section['id'];
     if ('paypal' == $section) {
         $post_data = $_POST['lpr_settings'][$this->id];
         $settings->set('paypal', $post_data);
     } else {
         do_action('learn_press_save_' . $this->id . '_' . $section);
     }
     $settings->update();
     return;
     $payment_options = get_option('_lpr_payment_settings', array());
     $section = isset($_GET['section']) ? $_GET['section'] : 'paypal';
     $params = isset($_POST['lpr_settings']['payment'][$section]) ? $_POST['lpr_settings']['payment'][$section] : $payment_options[$section];
     $payment_options[$section] = $params;
     $payment_options['method'] = isset($_POST['lpr_settings']['payment']['method']) ? $_POST['lpr_settings']['payment']['method'] : '';
     $payment_options['third_party'] = isset($_POST['lpr_settings']['payment']['third_party']) ? $_POST['lpr_settings']['payment']['third_party'] : '';
     update_option('_lpr_payment_settings', $payment_options);
     return;
     $payment_options = get_option('_lpr_payment_settings', array());
     $payment_tab = isset($_GET['section']) ? $_GET['section'] : 'paypal';
     $params = isset($_POST['lpr_settings']['payment'][$payment_tab]) ? $_POST['lpr_settings']['payment'][$payment_tab] : $payment_options[$payment_tab];
     $payment_options[$payment_tab] = $params;
     $payment_options['woocommerce'] = isset($_POST['lpr_settings']['payment']['woocommerce']) ? $_POST['lpr_settings']['payment']['woocommerce'] : array();
     update_option('_lpr_payment_settings', $payment_options);
 }