MyBB Community Forums

Full Version: Test Plugin for new developers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
MyBB should build in an install function for plugins strictly for the templates. Would solve all the problems that way.

Create some type of "refresh" action that will attempt to undo and redo any template edits.
(2011-12-22, 07:28 PM)Dylan M. Wrote: [ -> ]
(2011-12-21, 07:46 AM)Pirata Nervo Wrote: [ -> ]I prefer it like this because plugin upgrades that require template updates can be done very easily.
@labrocca for 4 months!

Except that then the users lose all the customizations they made to said templates. Definitely the wrong way to do it. The right way? Use the template versions! Thats why the stupid things are there. Then you can do a version compare on reactivation and warn the user that there is an updated template... output it in some way and make them compare them I guess. I've got this on my TODO for my plugins.

Definitely not something I'd ever thought about including in my own plugins, but that sure does sound like a good idea! Is there a core template compare function in MyBB already (too lazy to look for myself)?
(2011-12-22, 07:39 PM)euantor Wrote: [ -> ]
(2011-12-22, 07:28 PM)Dylan M. Wrote: [ -> ]
(2011-12-21, 07:46 AM)Pirata Nervo Wrote: [ -> ]I prefer it like this because plugin upgrades that require template updates can be done very easily.
@labrocca for 4 months!

Except that then the users lose all the customizations they made to said templates. Definitely the wrong way to do it. The right way? Use the template versions! Thats why the stupid things are there. Then you can do a version compare on reactivation and warn the user that there is an updated template... output it in some way and make them compare them I guess. I've got this on my TODO for my plugins.

Definitely not something I'd ever thought about including in my own plugins, but that sure does sound like a good idea! Is there a core template compare function in MyBB already (too lazy to look for myself)?

Obviously there is something Toungue Otherwise how would the "Show revised templates" work?

I haven't taken the time to go through that section of code to find out how it works as yet though.
Suppose I'll take a look then. I don't tend to do many major template edits with plugin version revisions though.
(2011-12-22, 07:28 PM)Dylan M. Wrote: [ -> ]
(2011-12-21, 07:46 AM)Pirata Nervo Wrote: [ -> ]I prefer it like this because plugin upgrades that require template updates can be done very easily.
@labrocca for 4 months!

Except that then the users lose all the customizations they made to said templates. Definitely the wrong way to do it. The right way? Use the template versions! Thats why the stupid things are there. Then you can do a version compare on reactivation and warn the user that there is an updated template... output it in some way and make them compare them I guess. I've got this on my TODO for my plugins.

Never thought of doing that Toungue

I agree with labrocca, we need to update the existing system.
That's something I'll focus on when the new mods site is live, I'll make sure to tell you my suggestion guys.
Tomm already said not to change what we have, and he has good points as why not to Toungue

Main one being: People don't properly use what already exists.

As for having a special template install function, I disagree. We need a minor edit to find_replace_templatesets() as discussed elsewhere, and just hook in when add a new theme. And then, as I stated above, make plugin templates work just like core templates and you wont have issues there either!
I don't agree with that. I think that if we can make developers' life easier then better plugins will be made and of course what should be standard will be more common among most of the plugins.
(2011-12-22, 09:25 PM)Pirata Nervo Wrote: [ -> ]I don't agree with that. I think that if we can make developers' life easier then better plugins will be made and of course what should be standard will be more common among most of the plugins.

Depends, does it really make developers life easier? I think if people properly use most of what we have its already pretty easy. A whole core function for plugins could only be good if it did everything automatically. And it can't be a required one, since that would break compatibility. I'm personally only against stuff that will make our life more difficult but gain little to nothing for plugins over what we have.
It'd be easy enough to add custom templates to MyBB's find updated templates routine including the ability to show a diff. This can be done by versioning them and adding the current version to the master template class. It would also be the only way to give users the ability to revert templates that were added by plugins, without reundeinstactivating it. It'd also remove the option to delete the template - as long as the plugin is installed that shouldn't be done anyhow.

It's not supposed to be used this way but it's what'd make the most sense IMHO. If you expect people to edit the plugin's templates to their liking, they have to behave the same way the original MyBB templates do in order to provide the same level of comfort.

I'll probably add a template install/uninstall function to PluginLibrary for this, although I only have one or two plugins that do templates at the moment (Overview and Gravatar). I try to avoid it altogether because template handling in plugins is crap. Smile
(2011-12-23, 01:09 AM)frostschutz Wrote: [ -> ]It'd be easy enough to add custom templates to MyBB's find updated templates routine including the ability to show a diff. This can be done by versioning them and adding the current version to the master template class. It would also be the only way to give users the ability to revert templates that were added by plugins, without reundeinstactivating it. It'd also remove the option to delete the template - as long as the plugin is installed that shouldn't be done anyhow.

It's not supposed to be used this way but it's what'd make the most sense IMHO. If you expect people to edit the plugin's templates to their liking, they have to behave the same way the original MyBB templates do in order to provide the same level of comfort.

I'll probably add a template install/uninstall function to PluginLibrary for this, although I only have one or two plugins that do templates at the moment (Overview and Gravatar). I try to avoid it altogether because template handling in plugins is crap. Smile

It isn't so much crap as undocumented Smile
You've basically just said, in much more detail, exactly what I suggested. Instead of everyone jumping all over this like white on rice, let me finish my new wiki tutorials I started on writing plugins. I think that will clarify a lot of the issues and undocumented functionality we have.

On that note: Pirata needs to add this new Example plugin to the svn so we can all see/work on the most updated copy. I'll probably write the whole template idea I've had and we've discussed here into it. I want it in there because I want this plugin to be the one I base my "Basic" level tutorial on. Once I take the time to look at this, I'll know if its feasible and a good idea to put a function for this into the plugins class in core MyBB. It probably is.

If added to core, it would be something like (pseudo code):
// $template is an array containing all template information. Version must be present.
function plugin_manage_template($template, $remove=0)
{
   if $remove = 1
       remove the template if it exists, and then return

   if the template exists already
      update the master template
   else
      insert the template as new
}

Edit: I'd also add something for managing template groups as well.
Pages: 1 2 3 4