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
Branches
Tags V2.0.0
No related merge requests found
BASE=usergroupsfield BASE=usergroupsfield
PLUGINTYPE=plug PLUGINTYPE=plug
ZIPBASE=opentools_cb ZIPBASE=opentools_cb2
VERSION=1.0 VERSION=2.0.0
PLUGINFILES=cb.$(BASE).php cb.$(BASE).xml PLUGINFILES=cb.$(BASE).php cb.$(BASE).xml
......
<?php <?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. * 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 * Based on the CBfield_userparams class of the cb.core.php plugin, copyright (C) Beat, JoomlaJoe, www.joomlapolis.com and various
* @version $Id$ * @version $Id$
...@@ -12,9 +12,12 @@ ...@@ -12,9 +12,12 @@
* @final 1.2 * @final 1.2
*/ */
/** ensure this file is being included by a parent file */ /** 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.' ); } if ( ! ( defined( '_VALID_CB' ) || defined( '_JEXEC' ) || defined( '_VALID_MOS' ) ) ) { die( 'Direct Access to this location is not allowed.' ); }
use CBLib\Application\Application;
global $_PLUGINS; global $_PLUGINS;
$_PLUGINS->loadPluginGroup( 'user', array( (int) 1 ) ); $_PLUGINS->loadPluginGroup( 'user', array( (int) 1 ) );
$_PLUGINS->registerUserFieldTypes( array( 'usergroupsfield' => 'CBfield_usergroups' ) ); $_PLUGINS->registerUserFieldTypes( array( 'usergroupsfield' => 'CBfield_usergroups' ) );
...@@ -151,11 +154,12 @@ class CBfield_usergroups extends cbFieldHandler { ...@@ -151,11 +154,12 @@ class CBfield_usergroups extends cbFieldHandler {
if ($reason=='search') if ($reason=='search')
return null; return null;
$i_am_super_admin = $_CB_framework->acl->amIaSuperAdmin(); $i_am_super_admin = Application::MyUser()->isSuperAdmin();
$canModifyUser = CBuser::getMyInstance()->authoriseAction( 'core.edit', 'com_users' ) // Use only the selected groups, do NOT require the group to have edit rights in the Backend!
|| CBuser::getMyInstance()->authoriseAction( 'core.edit.state', 'com_users' ); $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; $i_am_authorized = count(array_intersect($my_groups, $authorized_groups))>0;
if ( $i_am_super_admin || ($canModifyUser && $i_am_authorized)) { if ( $i_am_super_admin || ($canModifyUser && $i_am_authorized)) {
...@@ -203,11 +207,12 @@ class CBfield_usergroups extends cbFieldHandler { ...@@ -203,11 +207,12 @@ class CBfield_usergroups extends cbFieldHandler {
global $_CB_framework; global $_CB_framework;
$i_am_super_admin = $_CB_framework->acl->amIaSuperAdmin(); $i_am_super_admin = Application::MyUser()->isSuperAdmin();
$canModifyUser = CBuser::getMyInstance()->authoriseAction( 'core.edit', 'com_users' ) // Use only the selected groups, do NOT require the group to have edit rights in the Backend!
|| CBuser::getMyInstance()->authoriseAction( 'core.edit.state', 'com_users' ); $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', '')); $authorized_groups = $this->_explodeCBvalues($field->params->get('moderator_usergroups', ''));
$i_am_authorized = count(array_intersect($my_groups, $authorized_groups))>0; $i_am_authorized = count(array_intersect($my_groups, $authorized_groups))>0;
......
<?xml version="1.0" encoding="UTF-8"?> <?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> <name>CB Usergroups Field</name>
<author>Reiunhold Kainhofer</author> <author>Reinhold Kainhofer</author>
<creationDate>2014-01-09</creationDate> <creationDate>2014-01-09</creationDate>
<copyright>(C) 2014 Open Tools, Reinhold Kainhofer</copyright> <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> <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> <authorEmail>office@open-tools.net</authorEmail>
<authorUrl>www.open-tools.net</authorUrl> <authorUrl>www.open-tools.net</authorUrl>
<version>1.2</version> <version>2.0.0</version>
<description> <description>
A Community Builder field plugin that displays the Joomla groups in the profile and lets administrator modify the groups in the profile. A Community Builder field plugin that displays the Joomla groups in the profile and lets administrator modify the groups in the profile.
</description> </description>
...@@ -31,7 +31,7 @@ ...@@ -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."> <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="0">Show all groups in profile</option>
<option value="1">Restrict profile display to selected groups</option> <option value="1">Restrict profile display to selected groups</option>
</param> </param>
</params> </params>
</field> </field>
</fieldtypes> </fieldtypes>
...@@ -45,4 +45,4 @@ ...@@ -45,4 +45,4 @@
</uninstall> </uninstall>
<database> <database>
</database> </database>
</cbinstall> </cbinstall>
\ No newline at end of file
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment