Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support brianvu-tp

    (@briantp)

    Hi,

    You don’t need to use the code, You can go to LearnPress -> Order -> Create a new order for the user, select the course you need and set the status is completed -> Save.

    Thanks

    Plugin Author ThimPress

    (@thimpress)

    Hi,

    You can use below code example. Direct use is not recommended if you have no control over the use case. You must read and understand the code to be able to use it. If not will be make LP run wrong logic.

    $user_item_data = [
     'user_id' => $user_id,
     'item_id' => $course_id
     'start_time' => time();
     'status'       = LP_COURSE_ENROLLED;
     'graduation'   = LP_COURSE_GRADUATION_IN_PROGRESS;
    ];
    $user_item_new_or_update = new LP_User_Item_Course( $user_item_data );
    $result = $user_item_new_or_update->update();

    Read more code on the “handle_item_order_completed” method.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Enroll with code’ is closed to new replies.