Back to Access class

Method getGroupTitle

public static string
getGroupTitle
(mixed $groupId)
Method to return the title of a user group
Parameters
  • int $groupId Id of the group for which to get the title of.
Returns
  • string The title of the group
Since
  • 3.5
Class: Access
Project: Joomla

Method getGroupTitle - Source code

/**
 * Method to return the title of a user group
 *
 * @param   integer  $groupId  Id of the group for which to get the title of.
 *
 * @return  string  The title of the group
 *
 * @since   3.5
 */
public static function getGroupTitle($groupId)
{
    // Cast as integer until method is typehinted.
    $groupId = (int) $groupId;
    // Fetch the group title from the database
    $db = Factory::getDbo();
    $query = $db->getQuery(true);
    $query->select($db->quoteName('title'))->from($db->quoteName('#__usergroups'))->where($db->quoteName('id') . ' = :groupId')->bind(':groupId', $groupId, ParameterType::INTEGER);
    $db->setQuery($query);
    return $db->loadResult();
}