• Resolved secretsau

    (@secretsau)


    Hi,

    Currently when i export data, i get the titles to be text-406 or radio-450, how do i make them set to the current field names like Name or Email etc.

    Regards

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    You have to
    (1) go into your form definition (Contact -> Edit) and change the name of the field to what you want (this covers all future submissions)
    (2) update the field name in the DB (this covers all past submissions)
    —-

    (1) So if you have in your Contact Form 7 Definition something like:
    Your Choice: [radio radio-450 "first" "second" "third"]
    Just change the “radio-450” to be whatever you want (say your-choice), just be sure there are no spaces. The text in front of the form element (“Your Choice”) does not get submitted with the form. That is just for display. So when the form gets posted, it only know “radio-450=first” was what the user selected, for example. And my plugin saves that in the DB.

    Aside: Remember that if you renamed radio-450 then you also should change that in the email Message Body section (where it appears as [radio-450]) so that the email that gets sent to you includes that information. (Although this is irrelevant to my plugin)

    (2) If you have existing form submissions where the field is named radio-450 and you change the form definitions to say your-choice and get some new submission, then when you look at the table, you will see a column for both. Old ones will have the data in radio-450 while new ones will have data in your-choice. If you want to change the old ones, then you actually have to go into the DB and make a SQL query. This would be:

    update wp_CF7DBPlugin_SUBMITS set field_name = 'your-choice' where field_name = 'radio-450'

    Thread Starter secretsau

    (@secretsau)

    Thanks for that..

    This is a great plugin..

    Just one more question..

    How do i change the time on this plugin where it shows on the table “Submitted” because it seems to be wrong..

    Thanks again..

    Plugin Author Michael Simpson

    (@msimpson)

    That’s a little more tricky. You would have to use SQL update wp_CF7DBPlugin_SUBMITS set submit_time = newvalue where submit_time = currentvalue where you have to plug in the right numbers for newvalue and currentvalue.

    The trick is to get those numbers. submit_time in the DB is an integer value gotten from php time() then formatted for display via php date().

    So first you have to figure out what the currentvalue is (maybe look in the database table) then you have to compute what newvalue is. Take a look at php mktime(). You can try writing a simply php script to print out the time integer your want, then use that value in the SQL>

    msimpson,

    Maybe his time stamps were not in the correct timezone?

    I use this code in my contact form plugin, it makes a time stamp in the correct timezone in wordpress settings.

    $posted_data['date_time'] = date_i18n(get_option('date_format').' '.get_option('time_format'), time() );

    Then I refer the users to this help article on how to properly set the timezone in WordPress settings:
    https://www.fastsecurecontactform.com/tip-set-timezone
    As per the settings in my example, the time stamp would be in this format:
    January 23, 2011, 12:31 pm PST

    Plugin Author Michael Simpson

    (@msimpson)

    Great suggestion. I will add that as the default date-time display format.

    Hello there! How can I do this with checkbox?

    This is what I have in “ex_field5”

    Position: ,(1) point guard;(2) shooting guard;(3) small forward;(4) power forward;(5) center

    How do I change the field name to “POSITION” ?

    Many, many thanks in advance!

    Plugin Author Michael Simpson

    (@msimpson)

    (1) Change the name in the Contact Form 7 definition
    (2) In the DB:
    update wp_CF7DBPlugin_SUBMITS set field_name = 'POSITION' where field_name = 'ex_field5'

    “ex_field5” = he is using Fast Secure Contact Form

    Michael,

    It would be nice to get a rename fields code like this somewhere, but it would have to be individual for each form. We can discuss this in email if you like.

    //proposed rename database field names array
           $rename_fields = array();
           $rename_fields_test = explode("\n",$si_contact_opt['database_fields_rename']);
           if ( !empty($rename_fields_test) ) {
              foreach($rename_fields_test as $line) {
                if(preg_match("/=/", $line) ) {
                   list($key, $value) = explode("=",$line);
                   $key   = trim($key);
                   $value = trim($value);
                   if ($key != '' && $value != '')
                      $rename_fields[$key] = $value;
                }
              }
           }

    Mike Challis – FSCF

    Plugin Author Michael Simpson

    (@msimpson)

    I see. I need to know how to get a hold of $si_contact_opt[] from within my plugin. Feel free to shoot me an email with more details.

    msimpson: Thank you very much! It was a big help. This is awesome!!!

    One more thing…

    Why is it that new submissions are still picking up “ex_field5” ?
    I have a CHECKBOX that includes 5 options.

    I don’t quite follow this example of yours.
    ——————-
    Your Choice: [radio radio-450 “first” “second” “third”]
    ——————-

    Please help. Thank you very much!

    Plugin Author Michael Simpson

    (@msimpson)

    Are you using Contact Form 7 or Fast Secure Contact Form? (I was assuming the former)

    Hello. Thanks for quick response.

    I am using FSCF.

    Thank you!

    Plugin Author Michael Simpson

    (@msimpson)

    Sorry, I gave you the wrong info. I need to check back with Mike Challis (who wrote FSCF). I’m not yet familiar with all the ins-and-outs of FSCF.

    msimpson: Thank you in advance!

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘[Plugin: Contact Form 7 to Database Extension] How do i change the titles to the current field names’ is closed to new replies.