Extending Contact Form 7 Wordpress plugin by using hooks


Extending Contact Form 7 Wordpress plugin by using hooks



I would like to create a plugin that uses the contact form 7 hook, wpcf7_admin_after_mail. I want to use the plugin to interface with a CRM system. What I have thus far is the following:

//plugin header here  function add_to_CRM( $cf7 ) {     if (isset($cf7->posted_data["your-message"]))     {         full_contact($cf7);     } else {         quick_quote($cf7);     }     return $cf7; }  add_action('wpcf7_admin_after_mail', 'add_to_CRM');  //other functions here 

I can't seem to get this working. I can't even get the hook to work and do something like mail me. Anybody have any idea what I'm doing wrong here. Since I have limited Wordpress experience I might me missing the boat completely with what I'm trying to do here. I've Googled for answers to no end.

EDIT: I ended up adding this to the theme's functions.php file and it works perfectly. Thing is, I want to get it working as a plugin. Any help will be appreciated.


Highlighting Word(s) Searched on in WordPress Search

1:

Wordpress query_posts adding two “post-entry” divs, one with “post-thumbnail” and one without
Try delaying the add_action() call, any thing like;. Encrypt a wordpress plugin's submenu page with SSL
add_action('init', create_function('',     'add_action("wpcf7_admin_after_mail", "add_to_CRM");')); 
This actually registers your CF7 hook once WordPress is ready (which is nearer the time functions.php receive s loaded in).. wordpress custom theme option
Enable MathJax in RSS feeds for Wordpress blogs

71 out of 100 based on 56 user ratings 331 reviews

#