WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form Clean and Simple
[resolved] After submitting settings, display only shows variables, not actual values... (12 posts)

  1. andrewbacon
    Member
    Posted 9 months ago #

    Since the Settings form pulls up only variables (like cff_PluginSettings::PublicKey();), you have to enter every single setting every time you change any setting. Is this the way it's supposed to work? Shouldn't the Settings form pull up the settings that are currently being used, rather than the variable names?

    It makes it really weird - it's not intuitive that you have to enter a value for every field - and yet can't see the values the settings are currently using!

    http://wordpress.org/extend/plugins/clean-and-simple-contact-form-by-meg-nicholas/

  2. megnicholas
    Member
    Plugin Author

    Posted 9 months ago #

    Hi Andrew,

    Thanks for getting in touch, my apologies for the problems you are experiencing. You're right, obviously this is not the way the plugin is supposed to behave! The setting values should be displayed not the names.

    I am puzzled as to what could be happening here.

    I know this might be a nuisance, but we need to check for conflicts with your installed theme and plugins.
    To do this can you activate twenty twelve theme and then disable all your other plugins. Test the contact form. Does it work ok now? If so then slowly add everything back one by one testing as you go.

    Also are you using the latest version of wordpress and the plugin?
    Which version of php are you using, is it the recommended minimum (5.2.4)?

    Thanks, Meghan

  3. andrewbacon
    Member
    Posted 9 months ago #

    I'm actually using the twentytwelve theme - well a child theme. When I deactivate my child theme and revert to stock 2012 and deactiveate all other plugins, the behavior is the same. WordPress 3.5.2, PHP 5.3.8.

  4. megnicholas
    Member
    Plugin Author

    Posted 9 months ago #

    I don't think I'm fully understanding what your problem is.
    Are you saying that your settings aren't being saved?

  5. andrewbacon
    Member
    Posted 9 months ago #

    Settings are being saved. When I call up the settings page, the field for recapcha public key, for example, says <?=cff_PluginSettings::PublicKey(); ?>, even though I've already entered and saved a public key. If I hit Submit on the settings page, my existing value will be updated to <?=cff_PluginSettings::PublicKey(); ?>

    It's the same for all the fields - the value displayed on the settings page isn't the actual value, it appear to be the name of the variable storing the value.

    I just figured it out - you didn't use <?php to start the code blocks... you only used <? - that shorthand is not supported on my server so it doesn't recognize it as code.

  6. andrewbacon
    Member
    Posted 9 months ago #

    I would use the beginning code block that is universally recognized if I was to suggest something... you have to have the short version enabled specifically.

  7. andrewbacon
    Member
    Posted 9 months ago #

    perhaps. lol

  8. megnicholas
    Member
    Plugin Author

    Posted 9 months ago #

    Ahh thanks for figuring that out! If you are happy to, why don't you change the code to the long version and I will do the same in the next update so you won't get this issue again.

  9. andrewbacon
    Member
    Posted 9 months ago #

    You know what - I don't think that's actually right. If I change the code block, php doesn't recognize a statement starting with an equal sign.

  10. andrewbacon
    Member
    Posted 9 months ago #

    OK, this appears to work.

    In class.cff_settings.php, starting line 232 where function create_fields is defined:

    function create_fields($args)
        {
            $fieldname = $args[0];
    
            switch ($fieldname)
            {
            case 'use_recaptcha':
                $checked = cff_PluginSettings::UseRecaptcha() == true ? "checked" : "";
    ?><input type="checkbox" <?php echo $checked; ?>  id="use_recaptcha" name="array_key[use_recaptcha]"><?php
            break;
            case 'load_stylesheet':
                $checked = cff_PluginSettings::LoadStyleSheet() == true ? "checked" : "";
    ?><input type="checkbox" <?php echo $checked; ?>  id="load_stylesheet" name="array_key[load_stylesheet]"><?php
            break;
            case 'recaptcha_public_key':
                $disabled = cff_PluginSettings::UseRecaptcha() == false ? "disabled" : "";
    ?><input <?php echo $disabled; ?> type="text" size="60" id="recaptcha_public_key" name="array_key[recaptcha_public_key]" value="<?php echo(cff_PluginSettings::PublicKey()); ?>" /><?php
            break;
            case 'recaptcha_private_key':
                $disabled = cff_PluginSettings::UseRecaptcha() == false ? "disabled" : "";
    ?><input <?php echo $disabled; ?> type="text" size="60" id="recaptcha_private_key" name="array_key[recaptcha_private_key]" value="<?php echo(cff_PluginSettings::PrivateKey()); ?>" /><?php
            break;
            case 'recipient_email':
    ?><input type="text" size="60" id="recipient_email" name="array_key[recipient_email]" value="<?php echo(cff_PluginSettings::RecipientEmail()); ?>" /><?php
            break;
            case 'subject':
    ?><input type="text" size="60" id="subject" name="array_key[subject]" value="<?php echo(cff_PluginSettings::Subject()); ?>" /><?php
            break;
            case 'sent_message_heading':
    ?><input type="text" size="60" id="sent_message_heading" name="array_key[sent_message_heading]" value="<?php echo(cff_PluginSettings::SentMessageHeading()); ?>" /><?php
            break;
            case 'sent_message_body':
    ?><textarea cols="63" rows="8" name="array_key[sent_message_body]"><?php echo(cff_PluginSettings::SentMessageBody()); ?></textarea><?php
            break;
            case 'message':
    ?><textarea cols="63" rows="8" name="array_key[message]"><?php echo(cff_PluginSettings::Message()); ?></textarea><?php
            break;
            case 'theme':
                $theme = cff_PluginSettings::Theme();
                $disabled = cff_PluginSettings::UseRecaptcha() == false ? "disabled" : "";
    ?>
                    <select <?php echo $disabled; ?> id="array_key[theme]" name="array_key[theme]">
                        <option <?php echo $theme == "red" ? "selected" : ""; ?> value="red"><?php _e('Red', 'cleanandsimple'); ?></option>
                        <option <?php echo $theme == "white" ? "selected" : ""; ?>  value="white"><?php _e('White','cleanandsimple'); ?></option>
                        <option <?php echo $theme == "blackglass" ? "selected" : ""; ?> value="blackglass"><?php _e('Blackglass', 'cleanandsimple'); ?></option>
                        <option <?php echo $theme == "clean" ? "selected" : ""; ?> value="clean"><?php _e('Clean','cleanandsimple'); ?></option>
                    </select>
                    <?php
            break;
            case 'use_client_validation':
                $checked = cff_PluginSettings::UseClientValidation() == true ? "checked" : "";
    ?><input type="checkbox" <?php echo $checked; ?>  id="use_client_validation" name="array_key[use_client_validation]"><?php
            break;
            default:
            break;
            }
        }
  11. megnicholas
    Member
    Plugin Author

    Posted 9 months ago #

    Yes that should work fine.
    I'm going to be putting this change into 4.1.2.
    Thanks for all your hardwork troubleshooting this!

  12. andrewbacon
    Member
    Posted 9 months ago #

    No problem - it wasn't that hard ;-). It's a nice plugin!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.