mfcc / zendesk-contact
Contact-Form using a honeypot for spam-protection and zendesk API for creating ticket
Requires
- php: >=5.3.0
- zendframework/zendframework: >=2.3
- zf-commons/zfc-base: >=0.0.1
This package is auto-updated.
Last update: 2024-11-29 04:49:12 UTC
README
MfccZendeskContact
This Modules provides a simple contact-form with spam-protection using a honeypot and Zendesk API for ticket creation. It is based on the OrgHeiglContact module by Andreas Heigl (https://github.com/heiglandreas/OrgHeiglContact).
The idea of the honeypot is based on a blogpost by Lorna Jane Mitchell (according to Andreas Heigl)
Install:
The suggested installation method is via composer:
php composer.phar require mfcc/zendesk-contact:dev-master
Usage:
- In your application.conf-file add the Module to the list of modules
- Configure your settings
- Link to the Form using
$this->url('contact')
- There is no step four.
View plugin:
Use echo $this->mfccContactWidget()
to show contact form anywhere in your views
Extend form:
Extend base contact form using init listeners in your Module.php like this:
public function onBootstrap(MvcEvent $e)
{
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
$em = $eventManager->getSharedManager();
$em->attach(
'MfccZendeskContact\Form\ContactForm',
'init',
function($e)
{
$form = $e->getTarget();
$form->add(
array(
'name' => 'username',
'options' => array(
'label' => 'Username',
),
'attributes' => array(
'type' => 'text',
),
)
);
}
);
}
Note that you need to render and process form for yourself if you extend it.
To process your customized form, you can use zendesk service. Customize your zendesk service with
$this->getServiceLocator()->get('zendeskService')->addTag($tag)
$this->getServiceLocator()->get('zendeskService')->addCustomField($key, $value)
etc.
See ZendeskService.php
And create ticket like this:
$this->getServiceLocator()->get('zendeskService')->createTicket($fromName, $fromEmail, $yourCustomizedBody);