/**
* Method to bind the user, user groups, and any other necessary data.
*
* @param array $array The data to bind.
* @param mixed $ignore An array or space separated list of fields to ignore.
*
* @return boolean True on success, false on failure.
*
* @since 1.7.0
*/
public function bind($array, $ignore = '')
{
if (\array_key_exists('params', $array) && \is_array($array['params'])) {
$registry = new Registry($array['params']);
$array['params'] = (string) $registry;
}
// Attempt to bind the data.
$return = parent::bind($array, $ignore);
// Load the real group data based on the bound ids.
if ($return && !empty($this->groups)) {
// Set the group ids.
$this->groups = ArrayHelper::toInteger($this->groups);
// Get the titles for the user groups.
$query = $this->_db->getQuery(true)->select($this->_db->quoteName('id'))->select($this->_db->quoteName('title'))->from($this->_db->quoteName('#__usergroups'))->whereIn($this->_db->quoteName('id'), array_values($this->groups));
$this->_db->setQuery($query);
// Set the titles for the user groups.
$this->groups = $this->_db->loadAssocList('id', 'id');
}
return $return;
}