Bug tracker

This ticket has been moved to our new tracker. Open Ticket PHPBB3-8092 now.

$template->set_custom_template broken when original template stored in DB (fix completed in vcs)

Took me a while to figure out the cause for this one, but some people noted that our tools like UMIL and the Admin Tool Kit which use $template->set_custom_template were loading their board styles template file instead of the correct one.

The reason this happens is when the templates from their selected style are stored in the Database instead of using the Filesystem.

Another case for just dumping the internal style editors which store information in the database? ;)

Comments / History

Changed ticket severity from "Uncategorised/normal" to "Severe"

Action performed by EXreaction (Former Team Member) on Jan 15th 2009, 01:02

Posted by ToonArmy (Development Team Member) on Jan 15th 2009, 01:19

Sorry could you provide a little more detail as to the exact problem.

Posted by Highway of Life (QA Team) on Jan 15th 2009, 02:14

Nathan, does this happen because $user->setup is called before $template->set_custom_template ?

EDIT: The adm file calls set_custom_template (after user->setup), but I've never heard reports of this happening with the admin panel. But I did notice that the ACP sets...
$user->theme['template_storedb'] = false;
I don't believe we are doing that in either the ATK or UMIL, try setting that after set_custom_template and see if it works.

Edited post #134295

Action performed by Highway of Life (QA Team) on Jan 15th 2009, 02:17

Posted by EXreaction (Former Team Member) on Jan 15th 2009, 03:12

Yep, adding
$user->theme['template_storedb'] = false;

After we call the set_custom_template does the trick.

ToonArmy, download either the Admin Tool Kit or UMIL + example files. Set default style to store templates in the database instead of filesystem, purge the cache, then load either the admin tool kit or the umil_auto_example.php file. It should show your default style's index instead of our custom one.

@HoL, I'll commit that to the UMIL & ATK repositories for a work-around.

Posted by Highway of Life (QA Team) on Jan 16th 2009, 03:08

I think it would make sense if all templates would be set to not store in the DB if we're using the set_custom_template method.

Posted by EXreaction (Former Team Member) on Jan 16th 2009, 04:49

That could cause issues if the template was switched back on the same page (I wouldn't imagine that would ever happen, but it's possible).

Besides getting rid of the template_storedb completely (may make some people unhappy, but it gives everyone else headaches), I think the proper way to fix it would be to have it skip the
Code: Select all
if (isset($user->theme['template_storedb']) && $user->theme['template_storedb'])

check in includes/template.php.

If you changed that to say:
Code: Select all
if ($this->root == $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template' && isset($user->theme['template_storedb']) && $user->theme['template_storedb'])


That would work without any extra modifications, otherwise you could just add another variable when we are using a custom template path to check

Edited post #134515

Action performed by EXreaction (Former Team Member) on Jan 16th 2009, 04:50

Posted by Highway of Life (QA Team) on Jan 16th 2009, 07:15

Wow, that’s not at all what I meant... :? (just re-read my post).
I meant, that $user->theme['template_storedb'] should be set to false in the set_custom_template method.

Posted by EXreaction (Former Team Member) on Jan 16th 2009, 18:44

Like I said

That could cause issues if the template was switched back on the same page (I wouldn't imagine that would ever happen, but it's possible).

Basically if you would switch to a custom template path for loading say 1 file, parsing it to hold it in a variable for output later, then switching back to the user's default style. If the other templates were stored in the database, it would load the filesystem ones instead of the database ones after doing that. :P

Assigned ticket to group "Junior Developers"

Action performed by ToonArmy (Development Team Member) on Jun 17th 2009, 01:49

Assigned ticket to user "nickvergessen"

Action performed by nickvergessen (Development Team Member) on Jul 17th 2009, 08:50

Changed ticket status from "New" to "Fix in progress"

Action performed by nickvergessen (Development Team Member) on Jul 17th 2009, 08:50

Linked ticket with changeset: r9839

Action performed by nickvergessen (Development Team Member) on Jul 24th 2009, 08:47

Changed ticket status from "Fix in progress" to "Fix completed in SVN"

Action performed by nickvergessen (Development Team Member) on Jul 24th 2009, 08:47

Ticket details

Related SVN changesets