Example #1
0
 function get_user($field = '')
 {
     $user = LPR_User::instance($this->user_id);
     if ($field) {
         switch ($field) {
             case 'email':
                 return $user->user_email;
             default:
                 if (isset($user->{$field})) {
                     return $user->{$field};
                 }
         }
     }
     return $user;
 }
Example #2
0
function learn_press_send_user_email_order($status, $order_id)
{
    $status = strtolower($status);
    if ('completed' == $status) {
        $order = new LPR_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 = LPR_User::instance($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));
    }
}