Customizing SMF > Mod Requests

Moving posts between topics

(1/1)

viperjason:
So I've seen two topics already about this:
http://www.simplemachines.org/community/index.php?topic=267810
and
http://www.simplemachines.org/community/index.php?topic=482505

Our current forum also desired this functionality and after a quick think, I found a quick and easy way to do the move.

Basically I saw that the current way was split and merge.  So why not have those functions combined?  So I wrote a mod that does that.

However I have a few problems...
1) Writing an install file is not my specialty
2) Testing it with 1 person only gets you so far.
3) I stripped out some annoyances and not sure if they are needed.  Since they are stripped out, and they are part of the original split/merge they might be needed....or they might be excess....don't know.

So I'm attaching all the changes required.  As you will see from the comments, the main file "MovePosts.php" is just a copy paste of SplitPosts.php with some minor tweaks. 

As far as the template goes it combines the SplitSelection HTML with the Main Merge HTML, use dropdown menus and viola...a newish template.

So basically I'm asking if anyone wants to review it, help me test it, and help me make it a package so it can be a real mod and not my hackyslash.

emanuele:
Hello viperjason and welcome to sm.org! :)

That was the same idea I wanted to follow for this mod. I didn't had time to explore it, but now I'm happy because someone else did it!! O:)
I'm glad you worked on it! :D

Quick look at the code, from what I can see, if you want, the entire mod can work without a single code edit, just using hooks!

In particular you'd need:
* integrate_pre_include (to include the file with the functions, or even a small file with just the basic functions to add the couple of other hooks)
* integrate_actions (to create the new action you need instead of edit index.php)
* integrate_mod_buttons (to add the new button instead of edit Display.template.php)
thenyou can move the custom Xml template to your MovePosts.template.php (yes, maybe not elegant, but easier to handle than file edits), or to another template file that you'll load up the moment you need.

I know it may appear a bit complex, but it's not! And of course, feel free to ask any question! ;)

This is a tutorial that demonstrates how to add a new action using hooks, it could help you:
http://wiki.simplemachines.org/smf/Add_a_custom_action_using_integration_hooks
in case it doesn't feel free to tell what is not clear so that the tutorial can be improved!

viperjason:
I've only just started looking at SMF and I do like the design of everything.  Especially the templates vs using TPL.

Thank you very much for reviewing the code.  I will make those changes and get back to you with a new version.

I assume with the changes you proposed, it will make the install file easier since I don't need to deal with modifying the core?

emanuele:
Yep, the install would just be: tells pacman where put the files ($sourcedir for the source file, $themedir for the theme and $languagedir for the language file) and run a php script to "add" the hooks (and one during the uninstall to remove them).

viperjason:
ok, I think I've got it.

made use of integration hooks and the only file that gets modified is Modifications.english.php (as per the link provided).

Let me know if this package looks better?

Navigation

[0] Message Index

Go to full version