Plugin status ...

Plugin status ...

by Baptiste Lhoste -
Number of replies: 4

Hi everybody,

Is there a way to know if a specific plugin is installed ? enabled ?

I am developing a plugin for provisional enrolment to my site.

I need to known in my theme plugin if the provisional enrolment plugin is installed and enabled so I will add a link (or not) to it in my header.

Thanks in advance.

Best regards,

Tistou 

Average of ratings: -
In reply to Baptiste Lhoste

Re: Plugin status ...

by Stuart Mealor -

If you are using Moodle 2.7 or higher it's easy !

Site administration > Plugins > Plugins overview

You can then see something like:

"Installed: 354    Disabled: 67     Additional: 1"

and also a link:

"Show additional plugins only"

(I'm not sure if this was available in 2.6 too?)

In reply to Stuart Mealor

Re: Plugin status ...

by Baptiste Lhoste -

Hi M. Mealor,

First of all, thanks for your answer.

I misspoke, I would like to have this information in my PHP code, not by using the user interface.

Best regards,

Tistou

In reply to Baptiste Lhoste

Re: Plugin status ...

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
There isn't a generic 'is this plugin installed and enabled' function in Moodle (maybe there should be, but 'enabled' is determined in different ways for different plugins).

However, in the case of enrolment plugins you're in luck.

enrol_is_enabled('name of enrol plugin'); // Returns true if the plugin is enabled

enrol_get_plugin('name of enrol plugin'); // Returns the plugin, or null if it is not installed.

See lib/enrollib.php, enrol_try_internal_enrol() for an example of this in use.


In reply to Davo Smith

Re: Plugin status ...

by Baptiste Lhoste -

Hi M. Smith,

Thanks for your answer, that was exactly what I was searching for.

Best regards,

Tistou