This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Set Post Status by Field Value | |
* http://gravitywiz.com/2012/05/04/set-post-status-by-field-value/ | |
*/ | |
// update "3" to the ID of your form | |
add_filter('gform_post_data_3', 'gform_dynamic_post_status', 10, 3); | |
function gform_dynamic_post_status($post_data, $form, $entry) { | |
// update "5" to the ID of your custom post status field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gravity Wiz // Gravity Forms // Skip Pages on Multi-Page Form | |
* http://gravitywiz.com/2012/05/04/pro-tip-skip-pages-on-multi-page-forms/ | |
*/ | |
add_filter("gform_pre_render", "gform_skip_page"); | |
function gform_skip_page($form) { | |
if(!rgpost("is_submit_{$form['id']}") && rgget('form_page') && is_user_logged_in()) | |
GFFormDisplay::$submission[$form['id']]["page_number"] = rgget('form_page'); | |
return $form; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// register field IDs 1 and 2 on form ID 8 | |
register_confirmation_fields(8, array(1, 2)); | |
// register field IDs 12 and 14 on form ID 2 | |
register_confirmation_fields(2, array(12, 14)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gravity Wiz // Gravity Forms // Double Confirmation Fields | |
* | |
* Require a field's value to be entered twice to confirm it. | |
* | |
* @version 0.2 | |
* @author David Smith <david@gravitywiz.com> | |
* @license GPL-2.0+ | |
* @link http://gravitywiz.com/custom-field-confirmation/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Dynamically Populating User Role | |
* http://gravitywiz.com/2012/04/30/dynamically-populating-user-role/ | |
*/ | |
add_filter('gform_field_value_user_role', 'gform_populate_user_role'); | |
function gform_populate_user_role($value){ | |
$user = wp_get_current_user(); | |
$role = $user->roles; | |
return reset($role); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display Entries Left Based on Entry Limit | |
* http://gravitywiz.com/2012/04/25/display-number-of-entries-left-based-on-entry-limit/ | |
*/ | |
// update the "4" to the ID of your form | |
add_action('gform_pre_render_4', 'gform_display_limit'); | |
function gform_display_limit($form) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Limit User to One Submission Per Time Period | |
* http://gravitywiz.com/2012/04/25/limit-user-to-one-submission-per-time-period/ | |
*/ | |
// update the "5" to your form ID | |
add_action('gform_pre_render_5', 'gform_limit_submissions'); | |
function gform_limit_submissions($form){ | |
global $wpdb; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Close Comments when Post Created via Gravity Forms | |
* http://gravitywiz.com/2012/04/25/close-comments-when-post-created-via-gravity-forms/ | |
*/ | |
// update the '6' to the ID of your form | |
add_filter('gform_post_data_6', 'gform_close_comments'); | |
function gform_close_comments($post_data){ | |
$post_data['comment_status'] = 'closed'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$from_name = 'Your Name'; | |
$from_email = 'your@email.com'; | |
$subject = 'Your Subject Here'; | |
$message = 'Your message here.'; |