Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter adamkowalski

    (@adamkowalski)

    @jurasjo

    Thanks for the tip, I will definitely take advantage of this!

    @thomasplevy, @kenfrederick

    This is what I was planning on doing, essentially I want to check in code whether the video has finished playing and then trigger a lesson complete action. I guess I am wondering if there is an idiomatic way to do just that last part.

    Do you guys provide an API for triggering a lesson complete / course complete action given a student id and a course id?

    Thread Starter adamkowalski

    (@adamkowalski)

    @thomasplevy,

    Thank you for all your help, I will mark this as resolved as I think I know how to finish up from here. I will definitely try to get us onto a path where we can upgrade the version relatively soon. It seems like you guys have implemented a lot of exciting features that would be nice to incorporate into our project.

    Thread Starter adamkowalski

    (@adamkowalski)

    The strange thing is, that when I started drilling around in the database it seems like it is stored as just a WordPress post and it has a field called post_content.

    I extracted that data out and just looked at it as a regular html document and it looks correct, with the names and dates as intended. I will try to dig around and see what the code looks like where the template string is replaced with the actual data.

    Thread Starter adamkowalski

    (@adamkowalski)

    @thomasplevy,

    Thank you for letting me know!

    After playing around with the code above it seems that I had to change one line:

    $certificate = $this->emails['LLMS_Certificate_User'];
    // to
    $certificate = $this->certs['LLMS_Certificate_User'];

    As $this->emails wasn’t in scope. After making that change and calling the function with the parameters you suggested (person_id, cert_id, cert_id) I was able to give a student a certificate!

    However, unfortunately the template did not correctly render and all the tags such as {first_name} and {last_name} do not get replaced with the students information and are instead blank. Is there a good way to solve this problem? Right now I am thinking about running a sql query to find the actual certificate and parse the generated certificate placing the correct information where it belongs.

    Thread Starter adamkowalski

    (@adamkowalski)

    I have found a function called custom_certificate_earned in v1.4.3

    function custom_certificate_earned( $person_id, $certificate_id, $engagement_id ) {
      if ( ! $person_id )
        return;
    
      $certificate = $this->emails['LLMS_Certificate_User'];
    
      $certificate->trigger( $person_id, $certificate_id, $engagement_id );
    }

    Which seems to be analogous to trigger_engagement in v2.7.4

    function trigger_engagement( $person_id, $certificate_id, $related_post_id ) {
      $certificate = $this->certs['LLMS_Certificate_User'];
      $certificate->trigger( $person_id, $certificate_id, $related_post_id );
    }

    I have a person_id and a certificate_id to give it, but what would you use for an engagement_id if the certificate should be given regardless of whether or not the engagement has fired?

    Thread Starter adamkowalski

    (@adamkowalski)

    @thomasplevy,

    Thanks for the quick reply!

    So there is a bit of a hiccup in the project we are working on, as we already have a deployed project with version 1.4.3 Of LifterLMS. After looking through your reply and comparing the code on GitHub with our local version it seems as if the API has changed quite a bit in terms of engagements and certificates.

    We are going to discuss as a team the implications of migrating to a newer version, however, I am wondering if you could help me figure out how to approach this problem using the older version of the API.

Viewing 6 replies - 1 through 6 (of 6 total)