SlideShare a Scribd company logo
1 of 6
Download to read offline
Hello




This is a presentation on the versatility
of Gravity Forms in WordPress.

http://www.gravityhelp.com/documentation/page/Developer_Docs




@iamdangavin | iamdangavin@gmail.com
Hello




Checking a table within our database
and validation our form.

http://www.gravityhelp.com/documentation/page/Gform_validation




@iamdangavin | iamdangavin@gmail.com
Hello




     add_filter('gform_validation', 'code_validation');
     function code_validation($validation_result){
            // setting up to check against out database.
            global $wpdb;
            $input = $_POST['input_5'];
            $code_check = $wpdb->get_results("SELECT code FROM code_check WHERE code ="$input"");
            foreach($code_check as $row){
                    $code = $row->code;
            } //end foreach
            if($code != $input){
                   // set the form validation to false
                   $validation_result["is_valid"] = false;
                   //finding Field with ID of 1 and marking it as failed validation
                   foreach($validation_result["form"]["fields"] as &$field){
                           /NOTE: replace 5 with the field you would like to validate
                           if($field["id"] == "5"){
                                   $field["failed_validation"] = true;
                                   $field["validation_message"] = "Sorry, That code has either been used before or incorrect. Please try again!";
                                   break;
                           } //end if
                   } //end foreach
            } //end if
     return $validation_result;
     } //End function_exists




@iamdangavin | iamdangavin@gmail.com
Hello




Client Portal & Email Author of page

http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name




@iamdangavin | iamdangavin@gmail.com
Hello


gform_ eld_value_$parameter_name

Use this lter to add a default value to the eld speci ed by $parameter_name.




     add_filter('gform_field_value_current_client_ID', 'hidden_current_client_ID');
     function hidden_current_client_ID($value){
            global $curauth;
     return $curauth->ID;
     }




gform_noti cation_email

Use this lter to dynamically change the TO email for admin noti cation.




     // Hook to send the author an email that a message has been sent to them
     // Update the 1 in the gform_notification_email to your form ID. If you would like this to be a global change, remove the _1.
     add_filter("gform_notification_email_1", "change_notification_email", 10, 2);
     function change_notification_email($email, $form){
                   // update the '5' to the ID of your field
                   $email = $_POST['input_5'];
            return $email;
     }




@iamdangavin | iamdangavin@gmail.com
Goodbye




Resources & Plugins

• Gravity Forms Download

• Gravity Forms Documentation

• Gravity Forms + Custom Post Types Plugin

• Gravity Forms CSS




@iamdangavin | iamdangavin@gmail.com

More Related Content

What's hot

What's hot (20)

Curso Symfony - Clase 4
Curso Symfony - Clase 4Curso Symfony - Clase 4
Curso Symfony - Clase 4
 
Amp Up Your Admin
Amp Up Your AdminAmp Up Your Admin
Amp Up Your Admin
 
Curso Symfony - Clase 2
Curso Symfony - Clase 2Curso Symfony - Clase 2
Curso Symfony - Clase 2
 
WordPress: From Antispambot to Zeroize
WordPress: From Antispambot to ZeroizeWordPress: From Antispambot to Zeroize
WordPress: From Antispambot to Zeroize
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
 
November Camp - Spec BDD with PHPSpec 2
November Camp - Spec BDD with PHPSpec 2November Camp - Spec BDD with PHPSpec 2
November Camp - Spec BDD with PHPSpec 2
 
WordPress Theme Design and Development Workshop - Day 3
WordPress Theme Design and Development Workshop - Day 3WordPress Theme Design and Development Workshop - Day 3
WordPress Theme Design and Development Workshop - Day 3
 
Php Unit With Zend Framework Zendcon09
Php Unit With Zend Framework   Zendcon09Php Unit With Zend Framework   Zendcon09
Php Unit With Zend Framework Zendcon09
 
Goodbye hook_menu() - Routing and Menus in Drupal 8
Goodbye hook_menu() - Routing and Menus in Drupal 8Goodbye hook_menu() - Routing and Menus in Drupal 8
Goodbye hook_menu() - Routing and Menus in Drupal 8
 
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
 
Apostrophe
ApostropheApostrophe
Apostrophe
 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technology
 
Zero to SOLID
Zero to SOLIDZero to SOLID
Zero to SOLID
 
Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016
 
Php Enums
Php EnumsPhp Enums
Php Enums
 
購物車程式架構簡介
購物車程式架構簡介購物車程式架構簡介
購物車程式架構簡介
 
Modules and injector
Modules and injectorModules and injector
Modules and injector
 
Slimme Joomla! Templating Tips en Truuks
Slimme Joomla! Templating Tips en TruuksSlimme Joomla! Templating Tips en Truuks
Slimme Joomla! Templating Tips en Truuks
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
 
Oop php 5
Oop php 5Oop php 5
Oop php 5
 

Similar to Gravity Forms Hooks & Filters

מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםמ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
Miriam Schwab
 
Zend_Form to the Rescue - A Brief Introduction to Zend_Form
Zend_Form to the Rescue - A Brief Introduction to Zend_FormZend_Form to the Rescue - A Brief Introduction to Zend_Form
Zend_Form to the Rescue - A Brief Introduction to Zend_Form
Jeremy Kendall
 

Similar to Gravity Forms Hooks & Filters (20)

Tidy Up Your Code
Tidy Up Your CodeTidy Up Your Code
Tidy Up Your Code
 
Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDD
 
The new form framework
The new form frameworkThe new form framework
The new form framework
 
Drupal 8: Forms
Drupal 8: FormsDrupal 8: Forms
Drupal 8: Forms
 
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםמ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
 
WordCamp Denver 2012 - Custom Meta Boxes
WordCamp Denver 2012 - Custom Meta BoxesWordCamp Denver 2012 - Custom Meta Boxes
WordCamp Denver 2012 - Custom Meta Boxes
 
Business Rules with Brick
Business Rules with BrickBusiness Rules with Brick
Business Rules with Brick
 
Zend framework 04 - forms
Zend framework 04 - formsZend framework 04 - forms
Zend framework 04 - forms
 
Your code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConYour code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnCon
 
Михаил Крайнюк - Form API + Drupal 8: Form and AJAX
Михаил Крайнюк - Form API + Drupal 8: Form and AJAXМихаил Крайнюк - Form API + Drupal 8: Form and AJAX
Михаил Крайнюк - Form API + Drupal 8: Form and AJAX
 
TestFest - Respect\Validation 1.0
TestFest - Respect\Validation 1.0TestFest - Respect\Validation 1.0
TestFest - Respect\Validation 1.0
 
Forms in AngularJS
Forms in AngularJSForms in AngularJS
Forms in AngularJS
 
Zend_Form to the Rescue - A Brief Introduction to Zend_Form
Zend_Form to the Rescue - A Brief Introduction to Zend_FormZend_Form to the Rescue - A Brief Introduction to Zend_Form
Zend_Form to the Rescue - A Brief Introduction to Zend_Form
 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web services
 
CakePHP workshop
CakePHP workshopCakePHP workshop
CakePHP workshop
 
Unit testing zend framework apps
Unit testing zend framework appsUnit testing zend framework apps
Unit testing zend framework apps
 
Using of TDD practices for Magento
Using of TDD practices for MagentoUsing of TDD practices for Magento
Using of TDD practices for Magento
 
Adding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsAdding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy Applications
 
D8 Form api
D8 Form apiD8 Form api
D8 Form api
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

Gravity Forms Hooks & Filters

  • 1. Hello This is a presentation on the versatility of Gravity Forms in WordPress. http://www.gravityhelp.com/documentation/page/Developer_Docs @iamdangavin | iamdangavin@gmail.com
  • 2. Hello Checking a table within our database and validation our form. http://www.gravityhelp.com/documentation/page/Gform_validation @iamdangavin | iamdangavin@gmail.com
  • 3. Hello add_filter('gform_validation', 'code_validation'); function code_validation($validation_result){ // setting up to check against out database. global $wpdb; $input = $_POST['input_5']; $code_check = $wpdb->get_results("SELECT code FROM code_check WHERE code ="$input""); foreach($code_check as $row){ $code = $row->code; } //end foreach if($code != $input){ // set the form validation to false $validation_result["is_valid"] = false; //finding Field with ID of 1 and marking it as failed validation foreach($validation_result["form"]["fields"] as &$field){ /NOTE: replace 5 with the field you would like to validate if($field["id"] == "5"){ $field["failed_validation"] = true; $field["validation_message"] = "Sorry, That code has either been used before or incorrect. Please try again!"; break; } //end if } //end foreach } //end if return $validation_result; } //End function_exists @iamdangavin | iamdangavin@gmail.com
  • 4. Hello Client Portal & Email Author of page http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name @iamdangavin | iamdangavin@gmail.com
  • 5. Hello gform_ eld_value_$parameter_name Use this lter to add a default value to the eld speci ed by $parameter_name. add_filter('gform_field_value_current_client_ID', 'hidden_current_client_ID'); function hidden_current_client_ID($value){ global $curauth; return $curauth->ID; } gform_noti cation_email Use this lter to dynamically change the TO email for admin noti cation. // Hook to send the author an email that a message has been sent to them // Update the 1 in the gform_notification_email to your form ID. If you would like this to be a global change, remove the _1. add_filter("gform_notification_email_1", "change_notification_email", 10, 2); function change_notification_email($email, $form){ // update the '5' to the ID of your field $email = $_POST['input_5']; return $email; } @iamdangavin | iamdangavin@gmail.com
  • 6. Goodbye Resources & Plugins • Gravity Forms Download • Gravity Forms Documentation • Gravity Forms + Custom Post Types Plugin • Gravity Forms CSS @iamdangavin | iamdangavin@gmail.com