Skip to content
Snippets Groups Projects
Commit 5c8aca75 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V2.0.0: Update to CB2.0.2

parent 27fc122b
No related branches found
No related tags found
No related merge requests found
BASE=usergroupsfield
PLUGINTYPE=plug
ZIPBASE=opentools_cb
VERSION=1.0
ZIPBASE=opentools_cb2
VERSION=2.0.0
PLUGINFILES=cb.$(BASE).php cb.$(BASE).xml
......
<?php
/**
* Joomla Community Builder User groups Field Type Plugin: plug_cbusergroupsfield
* Joomla Community Builder 2.x User groups Field Type Plugin: plug_cbusergroupsfield
* Lets the administrator change the user's joomla groups in the CB profile in the FE.
* Based on the CBfield_userparams class of the cb.core.php plugin, copyright (C) Beat, JoomlaJoe, www.joomlapolis.com and various
* @version $Id$
......@@ -12,9 +12,12 @@
* @final 1.2
*/
/** ensure this file is being included by a parent file */
if ( ! ( defined( '_VALID_CB' ) || defined( '_JEXEC' ) || defined( '_VALID_MOS' ) ) ) { die( 'Direct Access to this location is not allowed.' ); }
use CBLib\Application\Application;
global $_PLUGINS;
$_PLUGINS->loadPluginGroup( 'user', array( (int) 1 ) );
$_PLUGINS->registerUserFieldTypes( array( 'usergroupsfield' => 'CBfield_usergroups' ) );
......@@ -151,11 +154,12 @@ class CBfield_usergroups extends cbFieldHandler {
if ($reason=='search')
return null;
$i_am_super_admin = $_CB_framework->acl->amIaSuperAdmin();
$canModifyUser = CBuser::getMyInstance()->authoriseAction( 'core.edit', 'com_users' )
|| CBuser::getMyInstance()->authoriseAction( 'core.edit.state', 'com_users' );
$i_am_super_admin = Application::MyUser()->isSuperAdmin();
// Use only the selected groups, do NOT require the group to have edit rights in the Backend!
$canModifyUser = true/*CBuser::getMyInstance()->authoriseAction( 'core.edit', 'com_users' )
|| CBuser::getMyInstance()->authoriseAction( 'core.edit.state', 'com_users' )*/;
$my_groups = $_CB_framework->acl->getGroupIds($_CB_framework->myId());
$my_groups = Application::MyUser()->getAuthorisedGroups(false);
$i_am_authorized = count(array_intersect($my_groups, $authorized_groups))>0;
if ( $i_am_super_admin || ($canModifyUser && $i_am_authorized)) {
......@@ -203,11 +207,12 @@ class CBfield_usergroups extends cbFieldHandler {
global $_CB_framework;
$i_am_super_admin = $_CB_framework->acl->amIaSuperAdmin();
$canModifyUser = CBuser::getMyInstance()->authoriseAction( 'core.edit', 'com_users' )
|| CBuser::getMyInstance()->authoriseAction( 'core.edit.state', 'com_users' );
$i_am_super_admin = Application::MyUser()->isSuperAdmin();
// Use only the selected groups, do NOT require the group to have edit rights in the Backend!
$canModifyUser = true/*CBuser::getMyInstance()->authoriseAction( 'core.edit', 'com_users' )
|| CBuser::getMyInstance()->authoriseAction( 'core.edit.state', 'com_users' )*/;
$my_groups = $_CB_framework->acl->getGroupIds($_CB_framework->myId());
$my_groups = Application::MyUser()->getAuthorisedGroups(false);
$authorized_groups = $this->_explodeCBvalues($field->params->get('moderator_usergroups', ''));
$i_am_authorized = count(array_intersect($my_groups, $authorized_groups))>0;
......
<?xml version="1.0" encoding="UTF-8"?>
<cbinstall version="1.0.0" type="plugin" group="user">
<cbinstall version="1.0" type="plugin" group="user">
<name>CB Usergroups Field</name>
<author>Reiunhold Kainhofer</author>
<author>Reinhold Kainhofer</author>
<creationDate>2014-01-09</creationDate>
<copyright>(C) 2014 Open Tools, Reinhold Kainhofer</copyright>
<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>1.2</version>
<version>2.0.0</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>
......@@ -31,7 +31,7 @@
<param name="restrict_display_selected" type="list" default="1" label="Groups display" description="Select whether the profile entry will display all group memberships or only those of the selected groups above. In any case, only the selected groups can be modified by the moderator.">
<option value="0">Show all groups in profile</option>
<option value="1">Restrict profile display to selected groups</option>
</param>
</param>
</params>
</field>
</fieldtypes>
......@@ -45,4 +45,4 @@
</uninstall>
<database>
</database>
</cbinstall>
\ No newline at end of file
</cbinstall>
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment