We have moved to Github. Please open tickets there.

Opened 3 years ago

Closed 2 years ago

#1457 closed Enhancement (fixed)

Add helper function to return only enabled plugins

Reported by: dr4g Owned by: brettp
Priority: low Milestone: Elgg 1.8.0
Component: API Version: 1.6
Severity: trivial Keywords: plugins
Cc: brettp Difficulty: easy

Description

I've created a plugin function here that returns a pure array of values with the plugins that have been installed and activated on the installation.

There are existing functions here but they return nested data structures and you have to iterate them yourself to identify the 'active' key. I'm referring to get_installed_plugins() here.
get_plugin_list() doesn't check for enabled.

Therefore i have coded get_active_plugin_list().
Not much need for a .diff file here it's really small.

/

  • Gets a list of all the loaded plugins that are tivated (not just installed)
  • @return array */

function get_active_plugin_list() {

$enabledPlugins = array();
foreach(get_plugin_list() as $plugin) {

if(is_plugin_enabled($plugin)) {

$enabledPlugins[] = $plugin;

}

}
return $enabledPlugins;

}

Let me know if you plan to include this in your /lib/plugins.php file so i can rely that it will existin future version when i upgrade.

Thanks.
Paul Dragoonis.

Change History (6)

comment:1 Changed 3 years ago by dr4g

Here is the pastebin link as wiki text seems to have messed with formatting.
http://pastebin.com/m5825fe21

comment:2 Changed 3 years ago by brettp

  • Keywords plugins added
  • Milestone changed from Elgg 1.7 to Elgg 1.8

comment:3 Changed 3 years ago by brettp

  • Summary changed from New Plugin Function to Add helper function to return only enabled plugins

comment:4 Changed 3 years ago by brettp

  • Difficulty set to easy
  • Priority changed from normal to low
  • Severity changed from minor to trivial

comment:5 Changed 3 years ago by brettp

  • Status changed from new to assigned

comment:6 Changed 2 years ago by brettp

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [svn:7488]) Fixes #1457. Added optional status param for get_installed_plugins()

Note: See TracTickets for help on using tickets.