Bug #23529 Bug Fixed

Non Super Admins unable to edit templates: ‘No such method: filter’

Version: 3.5.15 Reporter: quispiam

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

If a user wishes to edit a template and they are not a super admin EE throws an exception “No such method: filter’. This appears to be because of an incorrect call to Builder->first() before adding the final filter chain if the user has assigned groups.

I traced it to the following file;

EllisLab\ExpressionEngine\Controller\Design\Design.php in the function “manager”

Line: 108

$group = ee('Model')->get('TemplateGroup')
  ->fields('group_id', 'group_name')
  ->filter('group_name', $group_name) 
  ->filter('site_id', ee()->config->item('site_id'))
  ->first();
   if ($assigned_groups) 
   {
        $group->filter('group_id', 'IN', $assigned_groups);
   }

should possibly be:

$group = ee('Model')->get('TemplateGroup')
  ->fields('group_id', 'group_name')
  ->filter('group_name', $group_name) 
  ->filter('site_id', ee()->config->item('site_id'))
   
   if ($assigned_groups)
   {
      $group->filter('group_id', 'IN', $assigned_groups);
   }
   $group = $group->first();

Cheers

Matt.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases