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 | |
/** | |
* GP Auto Login // Gravity Perks // Bypass Custom Login System | |
*/ | |
add_action( 'gpal_pre_auto_login', function() { | |
remove_filter( 'authenticate', array( $GLOBALS['CAS_Maestro'], 'validate_login' ), 30, 3 ); | |
remove_filter( 'login_url', array( $GLOBALS['CAS_Maestro'], 'bypass_reauth' ) ); | |
} ); |
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
/** | |
* Gravity Wiz // Gravity Forms // Force Field with Default Value to Refresh on Save & Continue | |
*/ | |
add_action( 'gform_submission_values_pre_save', function( $values, $form ) { | |
// update "12" to the ID of your desired form | |
if( $form['id'] == 12 ) { | |
// update "4" to the field ID that should be refreshed on save & continue | |
$values[4] = false; | |
} |
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
/** | |
* Gravity Perks // GP Auto Login // Redirect to Custom URL on Auto Login | |
*/ | |
add_filter( 'gpal_auto_login_on_redirect_redirect_url', function( $url, $user_id ) { | |
$url = 'http://mysite.com/my-custom-url/'; | |
return $url; | |
}, 10, 2 ); |
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 | |
/** | |
* GP Limit Choices // Gravity Perks // Modify the "Out of Stock" Message | |
*/ | |
add_filter( 'gplc_out_of_stock_message', function( $not_enough_stock_message, $form, $field, $inventory_data ) { | |
return 'Sorry, friends. This item is no longer avialable.'; | |
}, 10, 4 ); | |
// only apply to form ID 1 | |
add_filter( 'gplc_out_of_stock_message_1', function( ) { /* custom code */ }, 10, 4 ); |
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 | |
add_filter("gform_pre_render", "populate_dropdown"); | |
function populate_dropdown($form){ | |
global $current_user; | |
get_currentuserinfo(); | |
foreach($form['fields'] as &$field) { | |
if($field['inputName'] == 'email') { | |
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
<script type="text/javascript"> | |
function gform_format_option_label( fullLabel, fieldLabel, priceLabel, selectedPrice, price, formId, fieldId ) { | |
return fieldLabel; | |
} | |
</script> |
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
/** | |
* Gravity Perks // GP Auto Login // Redirect to New Site on Auto Login | |
*/ | |
add_filter( 'gpal_auto_login_on_redirect_redirect_url', function( $url, $user_id ) { | |
require_once( GFUser::get_base_path() . '/data.php' ); | |
$entry_id = get_user_meta( $user_id, 'entry_id', true ); | |
$site_id = GFUserData::get_site_by_entry_id( $entry_id ); |
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
/** | |
* Populate Date: Year from Current Date | |
*/ | |
add_filter('gform_field_value_year_from_date', 'gw_year_from_date'); | |
function gw_year_from_date() { | |
return date('m/d/Y', strtotime('+1 year')); | |
} |
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 | |
/** | |
* Conditional Confirmations (with Merge Tag Support) | |
* http://gravitywiz.com/2012/08/18/conditional-confirmations/ | |
* | |
* Provides the ability to register conditional confirmations. To register a new conditional confirmation | |
* use the GWConditionalConfirmations::add_conditional_confirmation() function. | |
* | |
* GWConditionalConfirmations::add_conditional_confirmation($form_id, $field_id, $operator, $value, $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 | |
// example for form ID 7 where the confirmation will redirect the user to http://google.com if the value of field ID 3 is less than 10 | |
GWConditionalConfirmations::add_conditional_confirmation(7, 3, 'less_than', 10, array('redirect' => 'http://google.com')); | |
// example for form ID 5 where a text confirmation will be displayed if field ID 2 is equal to "Virginia" | |
GWConditionalConfirmations::add_conditional_confirmation(5, 2, 'is', 'Virginia', 'Confirmed! You are from Virginia!'); | |
// example for form ID 11 where the confirmation will redirect to the WordPress page ID 12 if the value of field ID 4 is greater than 500 | |
GWConditionalConfirmations::add_conditional_confirmation(11, 4, 'greater_than', 500, array('page' => 12)); |