Contact us mail form plugin with image verification by wirewolf, v1.1 - for Coppermine Photo Gallery, 1.4.x
Original mod by myself, wirewolf,
http://forum.coppermine-gallery.net/index.php?topic=37846.0For this plugin, original files for the codebase, configuration and the init.inc are from the devs, donnoman, gaugau, with modifications by BMossavari, Frantz (inspired from GYZMO's Add On) and adaptation by myself for this plugin. This is my first plugin for Coopermine and I learned a lot by studying the scripts from other plugins.
Original contact_us.php and english.php files by myself, randomimage.php file by unknown author. If anyone would like to provide translations for other languages, please do so.
This plugin will add a contact us mail form with image verification and a 'Contact Us' link on the top menu bar for Coppermine Photo Gallery, 1.4.x Tested with classic theme, not tested with others, but it should work.
The contact form will display error messages when a users fails to enter the required information. All fields are required, Name, Email Address, Subject, Comments, and the image verification code. It also allows for the user to 'Reset' the image if they have difficulty reading the code. The error messages are displayed right on the contact form page. Even if they have only entered partial information, the error messages will toggle on or off accordingly upon hitting the 'Submit' button. It not only checks for a required email address from the user, but it also checks that the email address they enter is correctly formatted.
A new image code is generated any time they hit the 'Submit' button without all of the required information entered, or if they hit the 'Reset Image' button. However, they will not lose any of the information they have entered up to that point. unless they hit the 'Reset Form' button (reloads the entire form) or, of course, leave the page.
They can't send a message until the form is successfully submitted, when they are then directed automatically to a 'Thank You Page'. The email is then sent via the email address you have entered in the Admin Control Panel. The email you receive not only has the users input, but contains a link to check out their ip address (with ARIN Whois) and lists their server agent.
See working plugin at
http://academyphotos.net/photogallery/index.php?file=contact_us/contact_usAdded the cpg_mail() function, so it should work with both mail() and SMTP (thanks to Nibbler for some guidance on the correct coding)
You can download the zip file at the end of this post. It contains all of the plugin files plus a README.txt file with full instructions. For those unfamilar with installing a plugin, see
http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#plugin_managerstep 1:
Download and unzip the archive - contact_us.zip
Upload the "contact_us" directory structure as is to your Coppermine gallery's plugins folder.
end upload plugin
step 2:
Login to your admin panel, go to config, then "Manage Plugins"
Find the Contact Us entry in the available plugins and click install.
A new menu button is now added for opening contact us mail form.
If you want, you can also add a link to the form in your custom footer, IE:
<a href="index.php?file=contact_us/contact_us">Contact Us</a>
Enjoy! wirewolf, John
If the devs like, please move move post accordingly, Thanks
Add On: Uploaded new zip file with corrections for cpg_mail function as suggested by Nibbler