Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've made the mistake of using the Grunion Contact Form plugin (it shipped with the Promotion theme that our webdevs installed in our Wordpress instance) instead of a real tool like SurveyGizmo, and now I'm stuck with a few hundred messages that I want to export in a sane format.

Tools -> Export -> Messages produced an XML that's horrible, and I'll have to write some script to pluck certain XML values and turn this mess into something sane. Is there a script like that already written?

Also, I couldn't find any tables in the database mirroring this data.

Here's what one <item> of the XML looks like:

<item>
    <title>Dan testing - 2012-10-01 02:46:43</title>
    <link>http://site.com/?post_type=feedback&#038;p=1617</link>
    <pubDate>Mon, 01 Oct 2012 09:46:43 +0000</pubDate>
    <dc:creator></dc:creator>
    <guid isPermaLink="false">http://site.com/?post_type=feedback&#038;p=1617</guid>
    <description></description>
    <content:encoded><![CDATA[Testing to see where the form feedback ends up.
<!--more-->
AUTHOR: Dan testing
AUTHOR EMAIL: dan+wp@site.com
AUTHOR URL: http://something.com
SUBJECT: [Site] Jobs
IP: 127.0.0.1
Array
(
    [Name] =&gt; Dan testing
    [Email] =&gt; dan+wp@site.com
    [I want to work for] =&gt; Site.com
    [LinkedIn profile] =&gt; http://something.com
    [Tell us about yourself] =&gt; Testing to see where the form feedback ends up.
)
]]></content:encoded>
    <excerpt:encoded><![CDATA[]]></excerpt:encoded>
    <wp:post_id>1617</wp:post_id>
    <wp:post_date>2012-10-01 02:46:43</wp:post_date>
    <wp:post_date_gmt>2012-10-01 09:46:43</wp:post_date_gmt>
    <wp:comment_status>closed</wp:comment_status>
    <wp:ping_status>closed</wp:ping_status>
    <wp:post_name>f55ef310f22fa18568d2002ae8660c6f</wp:post_name>
    <wp:status>publish</wp:status>
    <wp:post_parent>1359</wp:post_parent>
    <wp:menu_order>0</wp:menu_order>
    <wp:post_type>feedback</wp:post_type>
    <wp:post_password></wp:post_password>
    <wp:is_sticky>0</wp:is_sticky>
    <wp:postmeta>
        <wp:meta_key>_feedback_author</wp:meta_key>
        <wp:meta_value><![CDATA[Dan testing]]></wp:meta_value>
    </wp:postmeta>
    <wp:postmeta>
        <wp:meta_key>_feedback_author_email</wp:meta_key>
        <wp:meta_value><![CDATA[dan+wp@site.com]]></wp:meta_value>
    </wp:postmeta>
    <wp:postmeta>
        <wp:meta_key>_feedback_author_url</wp:meta_key>
        <wp:meta_value><![CDATA[http://something.com]]></wp:meta_value>
    </wp:postmeta>
    <wp:postmeta>
        <wp:meta_key>_feedback_subject</wp:meta_key>
        <wp:meta_value><![CDATA[[Site.com] Jobs]]></wp:meta_value>
    </wp:postmeta>
    <wp:postmeta>
        <wp:meta_key>_feedback_ip</wp:meta_key>
        <wp:meta_value><![CDATA[127.0.0.1]]></wp:meta_value>
    </wp:postmeta>
    <wp:postmeta>
        <wp:meta_key>_feedback_contact_form_url</wp:meta_key>
        <wp:meta_value><![CDATA[http://site.com/jobs/]]></wp:meta_value>
    </wp:postmeta>
    <wp:postmeta>
        <wp:meta_key>_feedback_all_fields</wp:meta_key>
        <wp:meta_value><![CDATA[a:5:{s:4:"Name";s:11:"Dan testing";s:5:"Email";s:18:"dan+wp@site.com";s:18:"I want to work for";s:8:"Site.com";s:16:"LinkedIn profile";s:20:"http://something.com";s:22:"Tell us about yourself";s:47:"Testing to see where the form feedback ends up.";}]]></wp:meta_value>
    </wp:postmeta>
    <wp:postmeta>
        <wp:meta_key>_feedback_extra_fields</wp:meta_key>
        <wp:meta_value><![CDATA[a:1:{s:18:"I want to work for";s:8:"Site.com";}]]></wp:meta_value>
    </wp:postmeta>
    <wp:postmeta>
        <wp:meta_key>_feedback_akismet_values</wp:meta_key>
        <wp:meta_value><![CDATA[a:47:{s:14:"comment_author";s:11:"Dan testing";s:20:"comment_author_email";s:18:"dan+wp@site.com";s:18:"comment_author_url";s:20:"http://something.com";s:20:"contact_form_subject";s:15:"[Site.com] Jobs";s:17:"comment_author_IP";s:12:"127.0.0.1";s:15:"comment_content";s:47:"Testing to see where the form feedback ends up.";s:12:"comment_type";s:12:"contact_form";s:7:"user_ip";s:12:"127.0.0.1";s:10:"user_agent";s:106:"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4";s:8:"referrer";s:24:"http://site.com/jobs/";s:4:"blog";s:18:"http://site.com";s:15:"SERVER_SOFTWARE";s:11:"nginx/1.2.3";s:11:"REQUEST_URI";s:6:"/jobs/";s:4:"USER";s:8:"www-data";s:4:"HOME";s:8:"/var/www";s:9:"FCGI_ROLE";s:9:"RESPONDER";s:12:"QUERY_STRING";s:0:"";s:14:"REQUEST_METHOD";s:4:"POST";s:12:"CONTENT_TYPE";s:33:"application/x-www-form-urlencoded";s:14:"CONTENT_LENGTH";s:3:"282";s:15:"SCRIPT_FILENAME";s:30:"/var/www/sitecom-wp/index.php";s:11:"SCRIPT_NAME";s:10:"/index.php";s:12:"DOCUMENT_URI";s:10:"/index.php";s:13:"DOCUMENT_ROOT";s:20:"/var/www/sitecom-wp";s:15:"SERVER_PROTOCOL";s:8:"HTTP/1.1";s:17:"GATEWAY_INTERFACE";s:7:"CGI/1.1";s:11:"REMOTE_ADDR";s:12:"127.0.0.1";s:11:"REMOTE_PORT";s:5:"64553";s:11:"SERVER_ADDR";s:14:"66.175.220.232";s:11:"SERVER_PORT";s:2:"80";s:11:"SERVER_NAME";s:11:"site.com";s:5:"HTTPS";s:0:"";s:15:"REDIRECT_STATUS";s:3:"200";s:9:"HTTP_HOST";s:11:"site.com";s:15:"HTTP_CONNECTION";s:10:"keep-alive";s:19:"HTTP_CONTENT_LENGTH";s:3:"282";s:18:"HTTP_CACHE_CONTROL";s:9:"max-age=0";s:11:"HTTP_ORIGIN";s:18:"http://site.com";s:15:"HTTP_USER_AGENT";s:106:"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4";s:17:"HTTP_CONTENT_TYPE";s:33:"application/x-www-form-urlencoded";s:11:"HTTP_ACCEPT";s:63:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";s:12:"HTTP_REFERER";s:24:"http://site.com/jobs/";s:20:"HTTP_ACCEPT_ENCODING";s:17:"gzip,deflate,sdch";s:20:"HTTP_ACCEPT_LANGUAGE";s:14:"en-US,en;q=0.8";s:19:"HTTP_ACCEPT_CHARSET";s:30:"ISO-8859-1,utf-8;q=0.7,*;q=0.3";s:8:"PHP_SELF";s:10:"/index.php";s:12:"REQUEST_TIME";s:10:"1349084803";}]]></wp:meta_value>
    </wp:postmeta>
    <wp:postmeta>
        <wp:meta_key>_feedback_email</wp:meta_key>
        <wp:meta_value><![CDATA[a:4:{s:2:"to";a:1:{i:0;s:18:"dan+wp@site.com";}s:7:"subject";s:15:"[Site.com] Jobs";s:7:"message";s:331:"Name: Dan testing
Email: dan+wp@site.com
LinkedIn profile: http://something.com
Tell us about yourself: Testing to see where the form feedback ends up.
I want to work for: Site.com


Time: Monday October 1, 2012 at 2:46 am
IP Address: 127.0.0.1
Contact Form URL: http://site.com/jobs/


Sent by a verified "Site.com" user.";s:7:"headers";s:111:"From: Dan testing <dan+wp@site.com>

Reply-To: dan+wp@site.com

Content-Type: text/plain; charset="UTF-8"";}]]></wp:meta_value>
    </wp:postmeta>
</item>
share|improve this question
2  
Where exactly did you find this "built-in Wordpress functionality"? I am not aware of WP shipping with an out-of-the-box contact form. –  Johannes Pille Jul 17 '13 at 12:28
    
There is no Tools -> Export -> Messages that I have ever seen, so you, or somebody, has hacked together something that you don't like and you blame WordPress? It would help to know what created those messages, but I'd guess you probably have to parse the XML. –  s_ha_dum Jul 17 '13 at 14:27
    
Also, I'd bet that the information itself is stored in the *_postmeta table, but that is a guess. –  s_ha_dum Jul 17 '13 at 14:31
    
My bad, I took over an existing Wordpress installation. The Contact Form functionality was provided by the Grunion Contact Form plugin. –  Dan Dascalescu Jul 21 '13 at 8:37
    
@s_ha_dum: indeed, the information is in wp_postmeta, but it's even nastier to extract it from there. I'll parse the XML. –  Dan Dascalescu Jul 21 '13 at 8:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.