- md5
- 54636a3bf3bb95471ba960e2726ccfa5
- sha1
- cd4ee225197c03dc6b1699a23f6a0416b2ca2cc5
- sha256
- ffbe0987db2ed60885ab35c1a8bccce970f3f9648e59a0696b0d023c17c1ea82
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JFormHelper::loadFieldClass('user');
/**
* Supports a modal select of users that have access to com_messages
*
* @since 1.6
*/
class JFormFieldUserMessages extends JFormFieldUser
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
public $type = 'UserMessages';
/**
* Method to get the filtering groups (null means no filtering)
*
* @return array|null array of filtering groups or null.
*
* @since 1.6
*/
protected function getGroups()
{
// Compute usergroups
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('id')
->from('#__usergroups');
$db->setQuery($query);
try
{
$groups = $db->loadColumn();
}
catch (RuntimeException $e)
{
JError::raiseNotice(500, $e->getMessage());
return null;
}
foreach ($groups as $i => $group)
{
if (JAccess::checkGroup($group, 'core.admin'))
{
continue;
}
if (!JAccess::checkGroup($group, 'core.manage', 'com_messages'))
{
unset($groups[$i]);
continue;
}
if (!JAccess::checkGroup($group, 'core.login.admin'))
{
unset($groups[$i]);
continue;
}
}
return array_values($groups);
}
/**
* Method to get the users to exclude from the list of users
*
* @return array|null array of users to exclude or null to to not exclude them
*
* @since 1.6
*/
protected function getExcluded()
{
return array(JFactory::getUser()->id);
}
}
The same content is in 30 releases, Joomla 3.9.15-rc to 3.10.0-alpha1. See them all, or every version of this file.