Member
Member
elyseston   2010-08-08, 23:58
#1

In order to allow my clients to use their galleries as an order form, I've added fields to the comment form so that on each image they can order different print sizes, etc. I've got the front-end all figured out, my question is how do I add these fields to the back-end part of the plugin so that the information is stored and posted?

Also, I tried monkeying with this some yesterday without any luck, but I wanted to basically have two versions of the comment form so that I could have albums open for 'normal' comments as well, without having the order information. What do I need to rename in both files in order to achieve this? This is not as big a deal as the previous question, however.

Member
Member
kagutsuchi   2010-08-09, 01:36
#2

If you've added the front-end, then you should be able to get the variables from your inputs via the $_POST superglobal. The comment_form plugin already shows how to do this in getUserInfo(). Note that the default plugin uses the filter save_comment_custom_data aliased to comment_form_save_comment to retrieve the information after it's submitted. What you do with the information after that entirely depends on how you want to use it.

I would suggest to leave the default comment_form plugin how it is. Doing so will help ease Zenphoto upgrades. I would simply rename your custom plugin and move it to the root plugins directory. Doing that should allow for both to be used in tandem. Just be careful that the functions are named differently than the default plugin and that any global variables specific to your plugin are unique as well.

Member
Member
elyseston   2010-08-09, 06:07
#3

Thanks for the response!

A few questions as I'm going over the files. First, something I think I might have missed at first. In the label column, I probably have to use the format, right? And then I use the name in as if (isset($_POST[$i.'-whatever'])) $result['whatever'] = sanitize($_POST[$i.'-comment_form_whatever'], 1); in the function getUserInfo($i), yes? Are there any other places I would need to be sure it's referenced?

To rename, then, I need to rename all of the functions and the name of the form, right? Can I do a simple replace all for "comment_form" to achieve most of those and then go through to rename the functions line by line? Would I be missing anything else that would need to be renamed?

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.