Train-Up! was written with developers in mind, and so lots of useful functions are made available to allow for maximum flexibility.
As a developer you can always access the Train-Up! plugin via tu()->
When Train-Up! is active, you will have access to the current post and the currently logged in user via:
tu()->post // Same as above: tu()->level, tu()->question, tu()->resource, tu()->test, tu()->result tu()->user // Same as above: tu()->group_manager, tu()->trainee
Here are some code samples
// Get the title of the Level that the current question is in. echo tu()->question->test->level->post_title; // Check if the current user has visited a Training Resource tu()->user->has_visited_resource(46); // Redirect to a Train-Up! page Pages::factory('Login')->go_to(); // Add a Trainee to a Group Trainees::factory('firstname.lastname@example.org')->add_to_group(28); // Check if a user can access a Training Level Users::factory(28)->can_access_level($level); // Get the Levels in a Group Groups::factory('Group A')->levels; // Get the next Question tu()->question->next
Each ‘model’ wraps a WordPress post. For example TU\Level is a wrapper for WP_Post
Lots of filters are provided so you can alter pretty much anything, like: The breadcrumbs that are automatically generated, or: how a particular question is deemed to be correct. For more information on that see custom questions.