Skip to content

Commit

Permalink
Respect access of editor plugin inside profile form
Browse files Browse the repository at this point in the history
  • Loading branch information
ggppdk committed Jun 11, 2018
1 parent 0c737b5 commit f136619
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
label="COM_ADMIN_USER_FIELD_EDITOR_LABEL"
description="COM_ADMIN_USER_FIELD_EDITOR_DESC"
folder="editors"
useaccess="1"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
Expand Down
1 change: 1 addition & 0 deletions components/com_users/models/forms/frontend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
label="COM_USERS_USER_FIELD_EDITOR_LABEL"
description="COM_USERS_USER_FIELD_EDITOR_DESC"
folder="editors"
useaccess="1"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
Expand Down
8 changes: 8 additions & 0 deletions libraries/joomla/form/fields/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ protected function getOptions()

if (!empty($folder))
{
$useAccess = (int) $this->element['useaccess'];

// Get list of plugins
$db = JFactory::getDbo();
$query = $db->getQuery(true)
Expand All @@ -126,6 +128,12 @@ protected function getOptions()
->where('enabled = 1')
->order('ordering, name');

if ($useAccess)
{
$groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
$query->where('access IN (' . $groups . ')');
}

$options = $db->setQuery($query)->loadObjectList();
$lang = JFactory::getLanguage();
$useGlobal = $this->element['useglobal'];
Expand Down

0 comments on commit f136619

Please sign in to comment.