Enables your WordPress site to act as an xAPI Learning Record Store.
PHP Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ext/minixapi
include
submodule
tpl
.gitignore
.gitmodules
Makefile
README.md
endpoint.php
readme.txt
wp-xapi-lrs.php

README.md

wp-xapi-lrs

Contributors: Tunapanda
Donate link: http://www.tunapanda.org/contribute
Tags: xapi, admin, learning, integration, lms, learning management system
Requires at least: 3.8.1
Tested up to: 4.7.1
Stable tag: trunk
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Lets your WordPress site to act as an xAPI Learning Record Store.

Description

This WordPress plugin enables your WordPress site to act as an xAPI enabled Learning Record Store. At the time of writing, the support is very basic. You can put statements in the database, and retreive them with some very basic filtering, but that's about it. It is possible to filter statements based on agent, verb, activity, statementId and related_activities, which is a subset from the complete list of filters found in the xAPI standard.

How to use

After the plugin is installed, you will find a settings page called xAPI LRS in the Settings section of the admin panel. On this page you will find the endpoint as well as credentials that can be used to connect to the LRS.

Testing from a hacker point of view

If you want to use this plugin in order to have a xAPI record store that other systems can connect to, the above is all you need. However, if you are more of a hacker type and you want to find out how xAPI actually works, this section is for you.

The username and password will be randomly generated upon installation. We can try to access the endpoint using curl:

curl "http://8260a014ad6016ba2af2ed0c0f7684e0:7078d3dc378947905994affa86c20d48@localhost/wordpress/wp-content/plugins/wp-xapi-lrs/endpoint.php/"
{
    "error": true,
    "message": "Expected xAPI method, try appending \/statements to the url."
}

This error message is given because according to the xAPI standard we need to specify which resource we want to access. Currently, the only implemented resource is the statements resource, so let's try to access that:

curl "http://8260a014ad6016ba2af2ed0c0f7684e0:7078d3dc378947905994affa86c20d48@localhost/wordpress/wp-content/plugins/wp-xapi-lrs/endpoint.php/statements"
{
    "statements": []
}

We are getting an empty list of statements back from the LRS, so something is working! Let's try to put a statements there. We can take the hang gliding example from Statements 101. The statement looks like this:

{
    "actor": {
        "name": "Sally Glider",
        "mbox": "mailto:sally@example.com"
    },
    "verb": {
        "id": "http://adlnet.gov/expapi/verbs/experienced",
        "display": { "en-US": "experienced" }
    },
    "object": {
        "id": "http://example.com/activities/solo-hang-gliding",
        "definition": {
            "name": { "en-US": "Solo Hang Gliding" }
        }
    }
}

Put the statement in a file called statement.json. Insert the statement using the following curl command:

curl -X POST --data-binary @statement.json  "http://8260a014ad6016ba2af2ed0c0f7684e0:7078d3dc378947905994affa86c20d48@localhost/wordpress/wp-content/plugins/wp-xapi-lrs/endpoint.php/statements"
[
    "e1dc2120-ca22-4500-96a2-611b32edfb70"
]

It worked! The data we got back is the UUID for the statement. Let's try to retreive it:

curl "http://8260a014ad6016ba2af2ed0c0f7684e0:7078d3dc378947905994affa86c20d48@localhost/wordpress/wp-content/plugins/wp-xapi-lrs/endpoint.php/statements"
{
    "statements": [
        {
            "id": "e1dc2120-ca22-4500-96a2-611b32edfb70",
            "stored": "2016-11-07T09:44:53.000+00:00",
            "actor": {
                "objectType": "Agent",
                "name": "Sally Glider",
                "mbox": "mailto:sally@example.com"
            },
            "verb": {
                "id": "http:\/\/adlnet.gov\/expapi\/verbs\/experienced",
                "display": {
                    "en-US": "experienced"
                }
            },
            "timestamp": "2016-11-07T09:44:53.000+00:00",
            "object": {
                "objectType": "Activity",
                "id": "http:\/\/example.com\/activities\/solo-hang-gliding",
                "definition": {
                    "name": {
                        "en-US": "Solo Hang Gliding"
                    }
                }
            }
        }
    ]
}

Yep, it seems like the statement is there!

Hacking and Development

Some small things to think about if you want to contribute to this plugin:

  • Don't update the README.md file. Update the readme.txt file, then build the README.md file using make readme. This in turn uses the wp2md command, so this needs to be installed on your system.

  • The minixapi module is linked as a git submodule, under the submodule directory. However, as a convenience it is also copied and checked in to this repository under the ext directory. In order to keep these copies in sync, you can run the command make copy-deps to copy the contents of the submodule to the ext directory. If you want to work on the submodule at the same time as you work on this repository, you can use the command make link-deps to create a symbolic link from the ext directory to the submodule directory. We want the copy of the submodule checked in to the repository, and not the link, so don't forget to run make copy-deps before you add files and commit!