• Skip to content
  • Skip to primary sidebar
  • Skip to footer

Foliovision

Making the web work for you

Main navigation

  • Weblog
    • FV Player
    • WordPress
    • Video of the Week
    • Case Studies
    • Business
  • About
    • Testimonials
    • Meet the Team
    • We Support
    • Careers
    • Contact
    • Pricing
  • Products
  • Support
    • FV Player Docs
    • Pro Support
  • Login
  • Basket is empty

How to create your own filled-in extension

Filled-in is very popular plugin for management of forms. It gives to user control over forms, validity checking of the data and many other options. Since much of the functionality rests in extendible part of filled-in: Extensions, I’ll focus on this part and will try to explain how do you create your own filled-in extension that will do exactly what you need.

First let’s explain some mechanics behind filled-in:

1. Filled-in check every content for forms. When it finds a form that is with id defined in filled-in, it extracts this form with all its content to add and alter the text of the form. Extensions take part in this process, since filter extensions have a method (Yes extensions are classes) modify which takes whole text as parameter and outputs it back, with or without some alterations. This way filled-in can pre-fill the input fields with incorrect values that were inserted by the user before.

I used this feature in FV Session extensions to add fields into the form depending on the input from previous forms.

2. Now the tough part: User submits the form. Now the extensions will be used to 100%.

filled in submission model
Filled-in form submission model

Firstly data submitted by the user need to be grabbed and verified. For this filled-in hooks to plugins_loaded action with function grab_post_data. This function executes extensions in specified order. First Pre extensions, then Filters and then Post. If anything goes wrong during the execution, the data will be stored with error, and the error will be shown to the user. If error happens in Pre or Post extensions, the execution of extensions stops right away and error is displayed to user. It Error occurs in Filter extension, all the filters gets executed, errors are gathered and are all shown to user.

Result extensions are executed from different function: form_clean. This one is called from the_content filter hook of WP. This means that the header and sidebar were already outputted (very important because it means that you no longer can output HTTP headers). Filters in here can be used to change the form to some thank you note, or redirect with javascript the user somewhere else (useful for AJAX forms).

Now one example of a more complicated set of extensions. We wanted to unify our conversion codes for trackers (conversion code should be shown after some of our quotes is filled). So we created this useful plugin, that we use internally for tracking and also to store the conversion codes. Since filled-in handles the forms, filled-in has to ask fv-tracker for the conversion code. Naturally this means we programmed a Result extension to to this.

Then (after working on MSN PPC campaigns) we needed to show the conversion code only once (never happened with google, but we all know that Microsoft always needs extra care). So we decided to cookie if he made a conversion or no. Now a problem. The cookie creation code cannot go into Result extension, since Result extension cannot set headers (to send cookie from PHP, you send a HTTP header to user browser). After few minutes (hours) of debugging we figured out the structure of filled-in and were able to create a solution. Since we don’t want to alter the source code of filled-in, we created another extension (Post) to update the cookie. So for the display of conversion code we needed two extensions. Not mostly clean, but it works (With more proper design of filled-in this would not be necessary).

Now when we explained the internal basics of filled-in, we can actually code some extension. The most important methods are:

  • process or filter (Depends on extension type)
  • name
  • show

Then there are other methods that extend the functionality

  • is_editable, edit, save (for editing the extensions)
  • modify (filter extensions only, change the input form)

Best way to learn to code it, inspire yourself on already coded extensions. I’ll not write more about how to code it, since then it’ll not be a brief guide. Experiment and you’ll get it right at the end.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You can click here to Subscribe without commenting

Primary Sidebar

My Account

  • My Licenses
  • My Profile
  • Invoices
  • Affiliate Area
  • Log Out

WordPress How To Guides

  1. StudioPress Tutorials
  2. WordPress Tutorial Videos for Foliovision Clients
  3. WordPress Plugins
  4. Shared.css Framework
  5. WordPress How To Guides
    1. How to Hack a WordPress Theme
    2. How to alter WordPress comment email
    3. How to reorder pages
    4. How to create your own filled-in extension
    5. Lost your password in WordPress?
    6. How to Comment Code in WordPress Templates
  6. WordPress Plugin Reviews

Footer

Our Plugins

  • FV WordPress Flowplayer
  • FV Thoughtful Comments
  • FV Simpler SEO
  • FV Antispam
  • FV Gravatar Cache
  • FV Testimonials

Free Tools

  • Pandoc Online
  • Article spinner
  • WordPress Password Finder
  • Delete LinkedIn Account
  • Responsive Design Calculator
Foliovision logo
All materials © 2023 Foliovision s.r.o. | Panská 12 - 81101 Bratislava - Slovakia | info@foliovision.com
  • This Site Uses Cookies
  • Privacy Policy
  • Terms of Service
  • Site Map
  • Contact
  • Tel. ‭+421 2/5292 0086‬

We are using cookies to give you the best experience on our website.

You can find out more about which cookies we are using or switch them off in settings.

Powered by  GDPR Cookie Compliance
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Necessary Cookies

Strictly Necessary Cookie allow you to log in and download your software or post to forums.

We use the WordPress login cookie and the session cookie.

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.

Support Cookies

Foliovision.com uses self-hosted Rocket.chat and self-hosted Freescout support desk to provide support for FV Player users. These cookies allow our visitors to chat with us and/or submit support tickets.

We are delighted to recommend self-hosted Rocket.chat and especially Freescout to other privacy-conscious independent publishers who would prefer to self-host support.

Please enable Strictly Necessary Cookies first so that we can save your preferences!

3rd Party Cookies

This website uses Google Analytics and Statcounter to collect anonymous information such as the number of visitors to the site, and the most popular pages.

Keeping this cookie enabled helps us to improve our website.

We reluctantly use Google Analytics as it helps us to test FV Player against popular Google Analytics features. Feel free to turn off these cookies if they make you feel uncomfortable.

Statcounter is an independent Irish stats service which we have been using since the beginning of recorded time, sixteen years ago.

Please enable Strictly Necessary Cookies first so that we can save your preferences!