WordPress.org

Support

Support » Plugins and Hacks » Fixed Field Suggestions

Fixed Field Suggestions

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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

    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.

    @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.

    @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? 😉

    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?

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fixed Field Suggestions’ is closed to new replies.