pmpro_getAddonBySlug

Find a PMPro addon by slug.

Description

(object) pmpro_getAddonBySlug( (object) $slug ); 

Returns (object)

$addon containing plugin information or false if not found

Parameters (1)

0. $slug (object)
The identifying slug for the addon (typically the directory name)

Usage

  1. if ( !function_exists( 'pmpro_getAddonBySlug' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/addons.php'; 
  3.  
  4. // The identifying slug for the addon (typically the directory name) 
  5. $slug = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = pmpro_getAddonBySlug($slug); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/addons.php  
  1. function pmpro_getAddonBySlug($slug) 
  2. $addons = pmpro_getAddons(); 
  3.  
  4. if(empty($addons)) 
  5. return false; 
  6.  
  7. foreach($addons as $addon) 
  8. if($addon['Slug'] == $slug) 
  9. return $addon; 
  10.  
  11. return false;