get_usergroup_parent_for_inherit_flag()

Description

Check if the usergroup has a parent and the specified inherit flag is in use e.g. user group inherits permissions from parent.

Parameters

ColumnTypeDefaultDescription
$usergroup_id int User group of the current user / user group to test.
$inherit_flag: string
$inherit_flag string Inherit flag to test for.

Return

int User group id of parent if found and using supplied inherit flag else returns user group id supplied.

Location

include/config_functions.php lines 466 to 482

Definition

 
function get_usergroup_parent_for_inherit_flag(int $usergroup_idstring $inherit_flag): int
{
    if (isset(
$GLOBALS['usergroup_parent_for_inherit_flag'][$usergroup_id])) {
        return 
$GLOBALS['usergroup_parent_for_inherit_flag'][$usergroup_id];
    }

    
$result $usergroup_id;

    
$usergroup_properties get_usergroup($usergroup_id);

    if (
$usergroup_properties !== false && $usergroup_properties['parent'] > && in_array($inherit_flag$usergroup_properties['inherit'])) {
        
$result $usergroup_properties['parent'];
    }

    
$GLOBALS['usergroup_parent_for_inherit_flag'][$usergroup_id] = $result# Cache value for subsequent calls to this function.
    
return $result;
}

This article was last updated 5th July 2025 11:35 Europe/London time based on the source file dated 4th July 2025 10:35 Europe/London time.