function learn_press_send_user_email_order($status, $order_id) { return; $status = strtolower($status); if ('completed' == $status) { $order = new LP_Order($order_id); $mail_to = $order->get_user('email'); $instructors = array(); $course_title = ''; $transaction_object = $order->get_items(); $items = $transaction_object->products; $item = array_shift($items); $course = get_post($item['id']); $course_title = get_the_title($item['id']); $instructor = LP_User::get_user($course->post_author); $instructors[$instructor->ID] = $instructor->data->display_name; learn_press_send_mail($mail_to, 'enrolled_course', apply_filters('learn_press_vars_enrolled_course', array('user_name' => $order->get_user('display_name'), 'course_name' => $course_title, 'course_link' => get_permalink($item['id'])), $course, $instructor)); } }
function save_user_answer($answer, $quiz_id, $user_id = null) { if ($user_id) { $user = LP_User::get_user($user_id); } else { $user = learn_press_get_current_user(); } if ($progress = $user->get_quiz_progress($quiz_id)) { if (!isset($progress->question_answers)) { $question_answers = array(); } else { $question_answers = $progress->question_answers; } $question_answers[$this->id] = $answer; $question_answers = apply_filters('learn_press_update_user_question_answers', $question_answers, $progress->history_id, $user_id, $this, $quiz_id); learn_press_update_user_quiz_meta($progress->history_id, 'question_answers', $question_answers); } //do_action( 'learn_press_update_user_answer', $progress, $user_id, $this, $quiz_id ); }
static function profile() { global $wp_query, $wp; if (isset($wp_query->query['user'])) { $user = get_user_by('login', $wp_query->query['user']); } else { $user = get_user_by('id', get_current_user_id()); } $output = ''; ob_start(); if (!$user) { if (empty($wp_query->query['user'])) { learn_press_get_template('profile/private-area.php'); } else { learn_press_display_message(sprintf(__('The user %s in not available!', 'learn_press'), $wp_query->query['user']), 'error'); } } else { $user = LP_User::get_user($user->id); $tabs = learn_press_user_profile_tabs($user); if (!empty($wp->query_vars['view'])) { $current = $wp->query_vars['view']; } else { $tab_keys = array_keys($tabs); $current = reset($tab_keys); } if (!learn_press_current_user_can_view_profile_section($current, $user)) { learn_press_get_template('profile/private-area.php'); } else { if (!empty($tabs) && !empty($tabs[$current])) { learn_press_get_template('profile/index.php', array('user' => $user, 'tabs' => $tabs, 'current' => $current)); } else { if ($wp->query_vars['view'] == LP()->settings->get('profile_endpoints.profile-order-details')) { /* $current_user = wp_get_current_user(); if ( $wp_query->query_vars['user'] != $current_user->user_login ) { learn_press_get_template( 'profile/private-area.php' ); return; }*/ $order_id = 0; if (!empty($wp->query_vars['id'])) { $order_id = $wp->query_vars['id']; } $order = learn_press_get_order($order_id); if (!$order) { learn_press_display_message(__('Invalid order!', 'learn_press'), 'error'); } else { learn_press_get_template('profile/order-details.php', array('user' => $user, 'order' => $order)); } } } } } $output .= ob_get_clean(); return $output; }
function learn_press_get_user($user_id) { return LP_User::get_user($user_id); }
static function profile() { global $wp_query; if (isset($wp_query->query['user'])) { $user = get_user_by('login', $wp_query->query['user']); } else { $user = get_user_by('id', get_current_user_id()); } $output = ''; if (!$user) { ob_start(); learn_press_display_message(sprintf(__('The user %s in not available!', 'learn_press'), $wp_query->query['user']), 'error'); $output .= ob_get_clean(); return $output; } ob_start(); learn_press_get_template('profile/index.php', array('user' => LP_User::get_user($user->id))); return ob_get_clean(); }