MyBB Community Forums

Full Version: Template Conditionals - it breaks Quick Edit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I installed "Template Conditionals" but when I click "Quick Edit", it simply says "Loading..." and won't do any more. "Full edit" works without problems. I also uninstalled "Template Conditionals" and tried "PHP in Templates" and the same happens.

I turned on error reports and it gave me the below error:

<br />

<b>Fatal error</b>:  Cannot declare class phptpl_templates, 
because the name is already in use in 
<b>/var/www/mybb/inc/plugins/phptpl.php(67) : eval()'d 
code</b> on line <b>2</b><br />

Does anyone know how to fix? My board is on PHP 7.4.

Thank you!
If you are using both PHP in Templates and Template Conditionals plugins, they are similar code. Template Conditionals is a smaller set of the larger PHP in Templates. Choose one or the other.
(2023-11-01, 01:24 AM)HLFadmin Wrote: [ -> ]If you are using both PHP in Templates and Template Conditionals plugins, they are similar code. Template Conditionals is a smaller set of the larger PHP in Templates. Choose one or the other.

Sorry, yes, I should have been clearer.

I installed Template Conditionals and it resulted in that error. I then uninstalled it and tried PHP in Templates, and it gave the same error. I don't have both installed at the same time.
"Uninstalled" means removed from /inc/plugins folder?
(2023-11-01, 11:55 AM)HLFadmin Wrote: [ -> ]"Uninstalled" means removed from /inc/plugins folder?

The filenames are actually the same for both plugins, so I had to delete one when I tried the other. So yes, completely removed.
I've deactivated plugins and MyAlerts is causing the error mentioned. With MyAlerts deactivated, Quick Edit works fine.

Does anyone know why that could be?

Thanks again.

EDIT

I worked out the problem. The global_start hook within phptpl was the same as MyAlerts. MyAlerts refers to global_start lots of times, whereas phptpl only refers to it once. So I changed the below in phptpl:

$plugins->add_hook('global_start', 'phptpl_run');

To:

$plugins->add_hook('phptpl_global_start', 'phptpl_run');

And the edit conflict is now fixed.