filter applink

From MoodleDocs

Introduction

With this plugin you can easily create links to open the Moodle App (or your custom app if you have one). You only need to specify the URL that you want to be opened (e.g. a course URL) and the filter will automatically create the URL to launch the app.

You can also specify if you want to use a certain username in the app.

This filter will be applied when the user navigates using a browser, but not when the user navigates using the app (the app is already open, you don't need to open it with a link).

Installation

You can download this plugin from the Moodle plugins directory or from the source repository. It can be installed using any of the methods supported by Moodle. If you are unsure, please visit this page.

To install it manually, unzip the plugin in the moodle .../filter/ directory.

Enabling/Disabling the filter on your site

The WebService filter must be enabled before it can be used on your Moodle site (it is disabled by default, after installation). To enable (or disable) the plugin site-wide, visit "Site Administration >> Plugins >> Filters >> Manage Filters", locate the 'Moodle App link' filter and click on the dropdown box to enable it (or disable it).

How to use

You need to add the attribute "data-app-link" to the links that you want to convert to a link to open the app:

<a href="https://domain.com/course/view.php?id=2" data-app-link>Click me</a>

If no value is assigned to data-app-link, the default URL scheme will be used. The default scheme can be changed in "Site Administration >> Plugins >> Filters >> Moodle App link". Leaving this setting empty will use the official Moodle app scheme: "moodlemobile".

If you want to force a scheme only for a certain link you can do it like this:

<a href="https://domain.com/course/view.php?id=2" data-app-link="myscheme">Click me</a>

Add a username

By default, no username will be added to the URL. This means that, if there are several users from that site stored in the app, the app will use the one that's currently logged in. If there is no user currently logged in, the user will have to choose which account does he want to use to open the link.

You can specify a username so the app will force to use that user. If there are several users from that site stored in the app, the app will always use the user you specified. In case that user is not stored, the user will be sent to the credentials screen and the username will be prepopulated.

You can force to use a certain username, like this:

<a href="https://domain.com/course/view.php?id=2" data-app-link data-username="john.smith">Click me</a>

If data-username is left empty, the filter will automatically add the username of the user that's viewing the link:

<a href="https://domain.com/course/view.php?id=2" data-app-link data-username>Click me</a>

In the example above, the app will be opened with the same user I'm using in browser.

Atto plugin

There is a plugin to add this filter using an Atto button. You can see the documentation in here.

See also