This file contains hidden or 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 | |
// Uses Loggedin – Limit Active Logins plugin: https://wordpress.org/plugins/loggedin/ | |
add_filter( 'loggedin_reached_limit', 'custom_login_limits', 10, 3 ); | |
function custom_login_limits($reached, $user_id, $count) { | |
// Check if user has custom limits and get value (fields added via ACF) | |
$unlimited_query = get_field('unlimited_logins', 'user_' . $user_id ); | |
$user_custom_limit = get_field('logins_limit', 'user_' . $user_id ); |
This file contains hidden or 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 | |
// Uses Loggedin – Limit Active Logins plugin: https://wordpress.org/plugins/loggedin/ | |
add_filter( 'loggedin_bypass', 'loggedin_bypass_users', 5, 2 ); | |
function loggedin_bypass_users( $bypass, $user_id ) { | |
// Check if user has unlimited logins (field added via ACF) | |
$unlimited_query = get_field('unlimited_logins', 'user_' . $user_id ); | |
if ($unlimited_query) { |
This file contains hidden or 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_action( 'gform_after_submission_4', 'custom_function', 10, 2 ); // Replace 4 with your form id | |
function custom_function() { | |
// Do Something | |
} | |
?> |
This file contains hidden or 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_entry_field_value', function ( $value, $field, $entry, $form ) { | |
if ( '10' == $field->id && '4' == $form['id'] ) { // Replace 10 with your field id & 4 with your form id | |
$value = 'Custom Value'; | |
} | |
return $value; | |
}, 10, 4 ); | |
?> |
This file contains hidden or 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 | |
// To use, add ':decode' to merge tag e.g. HTML Field:1:decode | |
add_filter( 'gform_merge_tag_filter', function ( $value, $merge_tag, $modifier, $field, $raw_value, $format ) { | |
if ( $merge_tag != 'all_fields' && $modifier == 'decode' ) { | |
$value = htmlspecialchars_decode( $value ); | |
} | |
return $value; |
This file contains hidden or 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_save_field_value_4_10', 'custom_field_value', 10, 5 ); // form id = 4, field id = 10 | |
function custom_field_value() { | |
return 'New Value'; | |
} | |
?> |
This file contains hidden or 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 | |
// Replace 8 with your form ID | |
add_filter( 'gform_pre_render_8', 'populate_activity_field' ); | |
add_filter( 'gform_pre_validation_8', 'populate_activity_field' ); | |
add_filter( 'gform_pre_submission_filter_8', 'populate_activity_field' ); | |
add_filter( 'gform_admin_pre_render_8', 'populate_activity_field' ); | |
function populate_activity_field( $form ) { | |
foreach ( $form['fields'] as &$field ) { |