Files
ultimatemember/includes/core/um-actions-global.php
T

58 lines
1.6 KiB
PHP
Raw Normal View History

2014-12-15 22:38:07 +02:00
<?php
2017-12-18 15:36:04 +02:00
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
2016-01-31 09:39:02 -08:00
2014-12-15 22:38:07 +02:00
/***
*** @adds a form identifier to form
***/
add_action('um_after_form_fields', 'um_add_form_identifier');
function um_add_form_identifier($args){ ?>
2016-01-31 09:39:02 -08:00
<input type="hidden" name="form_id" id="form_id_<?php echo $args['form_id']; ?>" value="<?php echo $args['form_id']; ?>" />
2014-12-15 22:38:07 +02:00
<?php
}
2016-01-31 09:39:02 -08:00
2014-12-15 22:38:07 +02:00
/***
*** @adds a spam timestamp
***/
add_action('um_after_form_fields', 'um_add_security_checks');
2016-01-31 09:39:02 -08:00
add_action('um_account_page_hidden_fields', 'um_add_security_checks');
2014-12-15 22:38:07 +02:00
function um_add_security_checks($args){
if ( is_admin() ) return;
2016-01-31 09:39:02 -08:00
echo '<input type="hidden" name="timestamp" class="um_timestamp" value="'. current_time( 'timestamp' ) .'" />';
2016-01-31 09:39:02 -08:00
2014-12-15 22:38:07 +02:00
?>
2016-01-31 09:39:02 -08:00
<p class="<?php echo UM()->honeypot; ?>_name">
<label for="<?php echo UM()->honeypot . '_' . $args['form_id']; ?>"><?php _e( 'Only fill in if you are not human' ); ?></label>
<input type="text" name="<?php echo UM()->honeypot; ?>" id="<?php echo UM()->honeypot . '_' . $args['form_id']; ?>" class="input" value="" size="25" autocomplete="off" />
2014-12-15 22:38:07 +02:00
</p>
2016-01-31 09:39:02 -08:00
2014-12-15 22:38:07 +02:00
<?php
}
2016-01-31 09:39:02 -08:00
2014-12-15 22:38:07 +02:00
/***
*** @makes the honeypot invisible
***/
add_action('wp_head', 'um_add_form_honeypot_css');
function um_add_form_honeypot_css() { ?>
2016-01-31 09:39:02 -08:00
<style type="text/css">.<?php echo UM()->honeypot; ?>_name { display: none !important; }</style>
2016-01-31 09:39:02 -08:00
2014-12-15 22:38:07 +02:00
<?php }
2016-01-31 09:39:02 -08:00
2014-12-15 22:38:07 +02:00
/***
*** @empty the honeypot value
***/
2015-03-14 23:39:33 +02:00
add_action('wp_footer', 'um_add_form_honeypot_js', 99999999999999999 );
function um_add_form_honeypot_js() { ?>
2016-01-31 09:39:02 -08:00
<script type="text/javascript">jQuery( '#<?php echo UM()->honeypot; ?>' ).val( '' );</script>
2016-01-31 09:39:02 -08:00
2015-11-05 19:51:31 +08:00
<?php
2016-01-31 09:39:02 -08:00
}