Contact Form 7
[resolved] Can fields be initialized with php code ? (3 posts)

  1. supfred
    Posted 4 years ago #


    First of all, thanks a lot for your wonderful extension !
    I've searched for one thing, but i can't find any way do to this...

    Can we embed php code in the config form ?
    for example, i'd like to sign the form with the name of my website, but not hard-coded !
    with : <?php bloginfo( 'name' );?>

    Mainly, i'd like to initialise some field with php code too.
    would you have a solution ?

    I want to create a "send to friend" form, so i want to get the HTTP_REFERER var from PHP, and set it in a field of your form.

    Tanks a lot for your response.
    Best regards,

  2. Karesansui
    Posted 4 years ago #

  3. supfred
    Posted 4 years ago #

    It looks great !
    Thanks for your response.

    I finally add my own module of Contact form 7 : UrlReferer.
    I have added this php file in wp-content/plugins/contact-form-7/modules
    I haven't modify the tg_pane code (parameter in admin panel for this field type). You can do what you want.
    Modify the "wpcf7_urlReferer_shortcode_handler" php function to change the value of this field and make your own.
    You can put this file in your same directory, automaticaly, contact-form-7 will suggest this news field type in the combo-list of admin-panel.
    Download this file at:urlReferer.zip

    enjoy !

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic