WordPress.org

Ready to get started?Download WordPress

Forums

Custom Contact Forms
Fixed Field Suggestions (7 posts)

  1. superpotion
    Member
    Posted 1 year ago #

    These would be convenient:
    1. All time zones - dropdown
    2. All currencies - dropdown

    http://wordpress.org/extend/plugins/custom-contact-forms/

  2. superpotion
    Member
    Posted 1 year ago #

    Here's, the (untested!) code to add the timezone fixed field pull-down

    All files here are realative to wp-content/plugins/custom-contact-forms/

    Create file: modules/extra-fields/timezones_field.php containing this code:

    http://pastebin.com/vJ3aCi02

    In custom-contact-forms-admin.php

    Line 1009  <td><?php if ($fields[$i]->field_slug == 'fixedEmail' || $fields[$i]->field_slug == 'emailSubject' || $fields[$i]->field_slug == 'fixedWebsite' || $fields[$i]->field_slug == 'usaStates' || $fields[$i]->field_slug == 'datePicker' || $fields[$i]->field_slug == 'allCountries' || $fields[$i]->field_slug == 'allTimezones') { ?>
    
    Line 1068  <?php if ($fields[$i]->field_type != 'Checkbox' && $fields[$i]->field_slug != 'allCountries' && $fields[$i]->field_slug != 'allTimezones' && $fields[$i]->field_slug != 'usaStates') { ?>

    In custom-contact-forms-front.php insert after line 245

    } elseif ($field->field_slug == 'allTimezones') {
    		$field->field_value = $field_value;
    		$out .= '<div>' . "\n" . $this->getTimezonesCode($field, $form->id) . "\n" . '</div>' . "\n";

    and change what is now line 536

    if (!array_key_exists($key, $GLOBALS['ccf_fixed_fields'])
     || $key == 'fixedEmail' || $key == 'usaStates'
     || $key == 'fixedWebsite'|| $key == 'emailSubject'
     || $key == 'allCountries' || $key == 'allTimezones') {

    and insert after line 679

    function getTimezonesCode($field_object, $form_id){
    	ccf_utils::load_module('extra_fields/timezones_field.php');
    	$req = ($field_object->field_required == 1) ? '* ' : '';
    	$timezones_field = new ccf_timezones_field($field_object->field_class, $form_id, $field_object->field_value, $field_object->field_instructions);
    	return '<label for="'.ccf_utils::decodeOption($field_object->field_slug, 1, 1).'">'. $req .ccf_utils::decodeOption($field_object->field_label, 1, 1).'</label>' . "\n" . $timezones_field->getCode();
    		}

    In modules/db/custom-contact-forms-activate-db.php

    Insert after line 237:

    $timezones = array('field_slug' => 'allTimezones',
         'field_label' => __('Select a Timezone',
         'custom-contact-forms'), 'field_type' =>
         'Dropdown', 'user_field' => 0);

    and insert after what is now line 246:

    if (!$this->fieldSlugExists('allTimezones'))
          $this->insertField($timezones, true);

    Reinstall the plugin.

    ...but, if you don't want to reinstall the plugin: with phpMyAdmin add a record to [TABLE_PREFIX]_customcontactforms_fields with at least these fields:

    field_slug -> "allTimezones"
    field_label -> "Select a timezone"
    field_type -> "Dropdown"

    ...all other fields can be empty or 0.

    Voila!
    Denis

  3. cktalons
    Member
    Posted 1 year ago #

    Hmm...Would I do something similar to extend the label text length allowed? I'm having a hellofatime extending the label text length for a form. Any ideas? PHP is still a strange world to me.

    Link: Manuscript Submission

    Label getting cut off: "* Please discuss your market rationale, the big idea, specific marketing ideas, and/or why you feel th"

    In admin I cannot add more text than that, so I've got a feeling I need to modify the template itself. But where? How?

    Thanks in advance.

  4. superpotion
    Member
    Posted 1 year ago #

    @cktalons

    The problem you're having is not related to this thread's topic.

    It looks like there's a maximum label field length of about 100 characters that you're bumping your head against. I'll have a shufti.

  5. cktalons
    Member
    Posted 1 year ago #

    @superpotion

    Tis true, but the thread that it is related to (my thread), which I started a week ago, has gone unanswered. I'm close to desperate, and I saw that you might have a brilliant idea that may help. Does the not-so-subtle flattery help? ;-)

  6. superpotion
    Member
    Posted 1 year ago #

    I don't recommend changing the plugin code, because these changes will be lost when the plugin is updated. Have you tried shortening the label to, say, just "Market rationale" and then using the Field Instructions (tooltip) to explain the detail?

  7. cktalons
    Member
    Posted 1 year ago #

    That's a way better idea, and I'm sorry I didn't think of it first. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.