I have many templates, but I only get this error on one template (a pretty important one). If I click on the template name (or the edit/settings buttons) in the Control Panel, I get the following error:
Fatal error: Call to a member function getId() on null in /path/to/system/ee/EllisLab/ExpressionEngine/Controller/Design/Template.php on line 1125
I’ve tried copying and renaming the template, uploading it, deleting the old template and renaming the new template to the correct name. No luck.
This may have started after an upgrade from EE3 to the current version. Everything else is working fine.
Any thoughts?
That’s about always due to some corruption in the database. The template has a member_id saved, but it no longer exists in exp_members. Or it has access restrictions and it’s set to redirect to a template id that no longer exists. Does that get you pointed in the right direction?
Try running these queries- you can do it in something like phpmyadmin or in EE’s query form in utilities.
select * from exp_templates where no_auth_bounce != '' and no_auth_bounce NOT IN (select template_id FROM exp_templates)
select * from exp_templates where last_author_id NOT IN (select member_id FROM exp_members)
If you get any result on either one? Those have bad data in them.
So if you get any templates on that first one, you know the no_auth_bounce value is bad and you need to change it to something that does exist (or just blank it out).
That help?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.