Commit eccaf4bd authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

V2.0.1: Manually load user groups, becase in list view the gids are not properly loaded by default

parent 5c8aca75
BASE=usergroupsfield
PLUGINTYPE=plug
ZIPBASE=opentools_cb2
VERSION=2.0.0
VERSION=2.0.1
PLUGINFILES=cb.$(BASE).php cb.$(BASE).xml
......
......@@ -126,6 +126,16 @@ class CBfield_usergroups extends cbFieldHandler {
$lang->load( 'com_users' );
}
$gids = $user->gids;
if (empty($gids)) {
// Load the user groups from the database, because in list view the gids are NOT loaded!
// This is from CB\Database\Table\UserTable::afterBindFromDatabase,
// which is documented as WIP and not adviced to be called directly,
// so we duplicate the code here...
$gids = array_values( (array) \JFactory::getAcl()->getGroupsByUser( $this->id, false ) );
foreach ( $gids as $k => $v ) {
$gids[$k] = (string) $v;
}
}
$allgroups = $this->getUserGroupsMap();
$restrictedgroups = $this->_explodeCBvalues($field->params->get('usergroups', ''));
$restrict = $field->params->get('restrict_display_selected', 1);
......
......@@ -7,7 +7,7 @@
<license>http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2 or later</license>
<authorEmail>office@open-tools.net</authorEmail>
<authorUrl>www.open-tools.net</authorUrl>
<version>2.0.0</version>
<version>2.0.1</version>
<description>
A Community Builder field plugin that displays the Joomla groups in the profile and lets administrator modify the groups in the profile.
</description>
......@@ -45,4 +45,4 @@
</uninstall>
<database>
</database>
</cbinstall>
</cbinstall>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment