WordPress plugin intelligence profile

Motiforms

Motiforms is a WordPress plugin provided for creating forms programmatically using Symfony framework.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 4.8
Current version0.1.0
WordPress coverageTested up to WordPress 4.8
Minimum stackWP 3.8 · PHP —
Directory statusactive
Last directory update10 Nov 20178y ago
Active installations10Adoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Motiforms version 0.1.0 as active, updated 8y ago and tested up to WordPress 4.8.

Overview

About this plugin

WARNING

If you are not developer this plugin is not for you. Motiforms do not provide any WordPress admin interface to creating forms.

Features

  • Handle form logic
  • Field sanitization
  • Field validation
  • Built in html rendering helpers
  • Flexibility
  • Based on advanced Symfony framework

Get started

php file. And paste [contact] shortcode to your contact page.

use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;

class ContactForm {

/** * Form instance * * FormType */ private $form;

/** * ContacForm constructor * * @return ContacForm */ public function __construct() {

$this->define_hooks(); }

/** * Create and process contact form * * This method is executed by wp action hook. * It will be executed only on page which has contact * shortcode. * * @return void */ public function controller() {

global $post;

// Check if current view is page and page has content shortcode if ( is_page() && has_shortcode( $post->post_content, 'contact' ) ) {

$factory = mf_get_factory();

// Create form $this->form = $factory->create();

// Add fields to form $this->form->add( 'full_name', TextType::class ); $this->form->add( 'email', EmailType::class ); $this->form->add( 'message', TextareaType::class ); $this->form->add( 'submit', SubmitType::class );

// Get request object $request = mf_get_request();

// Handle request $this->form->handleRequest( $request );

// Check if form is valid if ( $this->form->isSubmitted() && $this->form->isValid() ) {

// Get data from the form $data = $this->form->getData();

// Define filters $filters = array( 'full_name' => FILTER_SANITIZE_STRING, 'email' => FILTER_SANITIZE_STRING | FILTER_SANITIZE_EMAIL, 'message' => FILTER_SANITIZE_STRING, );

// Fields sanitization $sanitized_data = filter_var_array( $data, $filters );

g. send an e-mail

// Redirect user with success parameter to prevent double submitting form wp_safe_redirect( $this->get_redirect_url() ); } } }

/** * Render contact form. * * This method is executed by contact shortcode. * * @return string */ public function render() {

$success = filter_input( INPUT_GET, 'success', FILTER_SANITIZE_NUMBER_INT );

if( '1' === $success ) { return sprintf('<h2>%s</h2>', __('Thank you for submitting the form. ') ); }

$form_view = $this->form->createView();

$engine = mf_get_engine();

return $engine['form']->form( $form_view, array('attr' => array('novalidate' => 'novalidate') ) );

}

/** * Method executed by constructor to define hooks and * create and render contact form. * * @return void */ private function define_hooks() {

add_action( 'wp', array( $this, 'controller' ) );

add_shortcode( 'contact', array( $this, 'render' ) ); }

/** * Build url for form redirect * * @return string */ private function get_redirect_url() {

$url = get_permalink();

$query = parse_url($url, PHP_URL_QUERY);

success=1'; }

return $url; } }

// Initialize contact form new ContactForm();

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • contact form
  • custom form
  • forms
  • symfony
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 4.8

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 4.8.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to4.8
Minimum requirementsWordPress 3.8 · PHP not listed
Update activity10 Nov 20178y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.