MyBB Community Forums

Full Version: Update templates with plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What is the best way to update templates on plugin activation so it can easly be reverted to the previous? I know you add a record to the templates table with the same template title, but what when they already changed that template.
Why don't you just put the images you had in your 1.1.x series, into the 1.2... most of them have the same name... you'll just have to make a few new images...
Snowy Wrote:Why don't you just put the images you had in your 1.1.x series, into the 1.2... most of them have the same name... you'll just have to make a few new images...
What?
I believe that wasn't my question Toungue

I would like to know what's the best way to modify a template on plugin activation and revert to it's previous state on deactivation.
Well, seeing as mybb 1.2 came out this morning, there isn't a plugin to do that...
Snowy Wrote:Well, seeing as mybb 1.2 came out this morning, there isn't a plugin to do that...
Still not an anwser to my question. I'm writting a plugin myself and I would like to know the best way to update a template from that plugin on activation.
There are functions to search and replace within the templates. Look at my "inline ads" mod for an example. I make a simple change on activation and revert the change when it's deactivated.
Aries-Belgium Wrote:What is the best way to update templates on plugin activation so it can easly be reverted to the previous? I know you add a record to the templates table with the same template title, but what when they already changed that template.

I doubt.
Basically how is the plugin going to change your old template code when you can't upload it into the themes for 1.2.

Its tedious to upgrade the themes especially if they have template changes.
labrocca Wrote:There are functions to search and replace within the templates. Look at my "inline ads" mod for an example. I make a simple change on activation and revert the change when it's deactivated.
Yes, that's what I was looking for: find_replace_templatesets()
Thanks Wink