Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 1666 to 1696

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
        
$py="";
        
$py get_plugin_yaml($plugin["name"], false);

        
# 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_values(array_unique($plugins));
}

This article was last updated 17th November 2024 15:05 Europe/London time based on the source file dated 8th November 2024 11:50 Europe/London time.