Support » Plugin: Uncanny Toolkit for LearnDash » Simple Course Timer data

  • Resolved ainstushar

    (@ainstushar)


    Hi there,

    We are thinking about purchasing the simple course timer for our site. We need to access this data for further automated processing. Does simple course timer have API/filters/hooks that easily allow us to get total time a user has spent on course (without using shortcode).

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Uncanny Owl

    (@uncannyowl)

    Hi @ainstushar ,

    It would be difficult to get the data you want; you’ll have to do some lookups, but the data itself is here.

    Here’s the file where we store the records, in case you want to see how it’s done:

    wp-content/plugins/uncanny-toolkit-pro/src/includes/simple_timer_performance.php

    Here’s how we do it:

    $meta_key = ‘uo_timer_’ . $course_ID . ‘_’ . $post_ID;
    $q = “SELECT meta_value FROM $wpdb->usermeta WHERE meta_key = ‘{$meta_key}’ AND user_id = {$current_user->ID}”;

    Data is stored in the user_meta table. The meta is ‘uo_timer_’ . $course_ID . ‘_’ . $post_ID and if the user is on the course page then $post_id will the the $course_id, otherwise $post_id will be the lesson, topic, or quiz ID.

    You could also take a look the code to see how our [uo_time] shortcode works; you could use the same method if you want to pull time data down for an entire course.

    I hope that helps.

    Thread Starter ainstushar

    (@ainstushar)

    Thank you! It does help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.