Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

register_group_access_plugins()

Description

Load group specific plugins and reorder plugins list

Parameters

ColumnTypeDefaultDescription
$usergroup int -1 Usergroup reference
$plugins array Enabled Plugins
enabled_groups
config
config_json
FROM disable_group_select 0 ORDER BY priority"
array
"plugins";

Return

array

Location

include/plugin_functions.php lines 1506 to 1537

Definition

 
function register_group_access_plugins(int $usergroup=-1,array $plugins = []): array
{
    
# Load group specific plugins and reorder plugins list
    
$active_plugins = (ps_query("SELECT name,enabled_groups, config, config_json, disable_group_select FROM plugins WHERE inst_version >= 0 ORDER BY priority", array(), "plugins"));

    foreach(
$active_plugins as $plugin)
        {
        
#Get Yaml
        
$plugin_yaml_path get_plugin_path($plugin["name"]) ."/".$plugin["name"].".yaml";
        
$py="";
        
$py get_plugin_yaml($plugin_yaml_pathfalse);

        
# Check group access and applicable for this user in the group, only if group access is permitted as otherwise will have been processed already
        
if(!$py['disable_group_select'] && $plugin['enabled_groups'] != '')
            {
            
$s=explode(",",$plugin['enabled_groups']);
            if (
in_array($usergroup,$s))
                {
                
include_plugin_config($plugin['name'],$plugin['config'],$plugin['config_json']);
                
register_plugin($plugin['name']);
                
register_plugin_language($plugin['name']);
                
$plugins[]=$plugin['name'];
                }
            }
        else
            {
            
$plugins[]=$plugin['name'];
            }
        }

    return 
array_unique($plugins);
}

This article was last updated 29th May 2024 08:35 Europe/London time based on the source file dated 7th May 2024 18:45 Europe/London time.