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
 

Recently uploaded (20)

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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
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?
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
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
 

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