<p>I found the answer in a bit of a clumsy way, but the capture plugin has two services, <code>capture_forms</code> and <code>capture_submissions</code>. The first deals with saving the forms within the CraftCMS admin, the latter is for dealing with the form submissions.</p>

<p>I had to simply change my listener to <code>craft()-&gt;on('capture_submissions.onPost', function(Event $event){...});</code> and I can see the event data.</p>

CC BY-SA 3.0
2016-05-25T12:13:15.007Z
2016-05-25T12:13:15.007Z
Alexander Holsgrove
<p>I am writing a new plugin to hook into a POST event from a bespoke form plugin called "Capture". The Capture plugin fires two different events; the code taken from <code>/craft/plugins/capture/services/Capture_SubmissionsService.php</code></p>

<pre><code>public function onBeforePost(Event $event) {
    $this-&gt;raiseEvent('onBeforePost', $event);
}

public function onPost(Event $event) {
    $this-&gt;raiseEvent('onPost', $event);
}
</code></pre>

<p>I called die(); inside each one so I know they are being called.</p>

<p>My new plugin is very simple. I would like to be able to hook into the onPost event and receive the form data. My plugin is very simple for now as I am just concerned with hooking into the event. The below example has getName, getDeveloper, getDescription, getVersion etc removed for ease of reading. This is the only file in my plugin: <code>/craft/plugins/myplugin/MyPlugin.php</code></p>

<pre><code>&lt;?php
namespace Craft;

class MyPlugin extends BasePlugin {

   public function init() {
      craft()-&gt;on('capture.onPost', function(Event $event){
         die('onPost &lt;pre&gt;'.print_r($event,true).'&lt;/pre&gt;');
      });
   }
}
</code></pre>

<p>But this doesn't seem to be get called. I am assuming that I need something other than <code>capture.onPost</code>.</p>

<p>I have used the following docs, but would appreciate any help.</p>

<p><a href="https://craftcms.com/docs/plugins/hooks-and-events" rel="nofollow">https://craftcms.com/docs/plugins/hooks-and-events</a></p>

<p><a href="https://craftcms.com/docs/plugins/events-reference" rel="nofollow">https://craftcms.com/docs/plugins/events-reference</a></p>

CC BY-SA 3.0
2016-05-25T12:04:12.020Z
Might sound like a silly question, but is MyPlugin installed and enabled in the Craft control panel?
Brad Bell
CC BY-SA 3.0
2016-05-25T12:09:14.580Z
Yes it is. I think I have found my problem now and will post as an answer. Thank you
Alexander Holsgrove
<plugin-development><events><hook>
How do I hook into Capture form onPost event?
# How do I hook into Capture form onPost event?

(Asked by: username_0 on 2016-05-25)

I am writing a new plugin to hook into a POST event from a bespoke form plugin called "Capture". The Capture plugin fires two different events; the code taken from /craft/plugins/capture/services/Capture_SubmissionsService.php
public function onBeforePost(Event $event) {
    $this->raiseEvent('onBeforePost', $event);
}

public function onPost(Event $event) {
    $this->raiseEvent('onPost', $event);
}

I called die(); inside each one so I know they are being called.
My new plugin is very simple. I would like to be able to hook into the onPost event and receive the form data. My plugin is very simple for now as I am just concerned with hooking into the event. The below example has getName, getDeveloper, getDescription, getVersion etc removed for ease of reading. This is the only file in my plugin: /craft/plugins/myplugin/MyPlugin.php
on('capture.onPost', function(Event $event){
         die('onPost '.print_r($event,true).'');
      });
   }
}

But this doesn't seem to be get called. I am assuming that I need something other than capture.onPost.
I have used the following docs, but would appreciate any help.
https://craftcms.com/docs/plugins/hooks-and-events
https://craftcms.com/docs/plugins/events-reference

**Tags:** plugin-development, events, hook
> **Comments:**
> **username_1**: Might sound like a silly question, but is MyPlugin installed and enabled in the Craft control panel?  
> **username_0**: Yes it is. I think I have found my problem now and will post as an answer. Thank you  

---

## 1 answers

### Answer by username_0 on 2016-05-25. Score: 1 | Accepted answer

I found the answer in a bit of a clumsy way, but the capture plugin has two services, `capture_forms` and `capture_submissions`. The first deals with saving the forms within the CraftCMS admin, the latter is for dealing with the form submissions.

I had to simply change my listener to `craft()->on('capture_submissions.onPost', function(Event $event){...});` and I can see the event data.


---

