- fixed fields validation based on field's privacy settings;

This commit is contained in:
nikitasinelnikov
2021-04-06 12:30:33 +03:00
parent b2bb2c13eb
commit a4a954b7e6
2 changed files with 136 additions and 80 deletions
+9 -9
View File
@@ -366,12 +366,15 @@ if ( ! class_exists( 'um\core\Form' ) ) {
*/
$this->post_form = apply_filters( 'um_submit_post_form', $_POST );
if ( isset( $this->post_form[ UM()->honeypot ] ) && $this->post_form[ UM()->honeypot ] != '' ) {
wp_die( __( 'Hello, spam bot!', 'ultimate-member' ) );
}
$this->post_form = $this->beautify( $this->post_form );
$this->post_form['submitted'] = $this->post_form;
$this->form_data = UM()->query()->post_data( $this->form_id );
$this->post_form['submitted'] = $this->post_form;
$this->post_form = array_merge( $this->form_data, $this->post_form );
// Remove role from post_form at first if role ! empty and there aren't custom fields with role name
@@ -438,10 +441,6 @@ if ( ! class_exists( 'um\core\Form' ) ) {
}
if ( isset( $_POST[ UM()->honeypot ] ) && $_POST[ UM()->honeypot ] != '' ) {
wp_die( __( 'Hello, spam bot!', 'ultimate-member' ) );
}
/**
* UM hook
*
@@ -518,18 +517,19 @@ if ( ! class_exists( 'um\core\Form' ) ) {
/**
* Beautify form data
*
* @param array $form
* @return array $form
*/
function beautify( $form ){
function beautify( $form ) {
if (isset($form['form_id'])){
if ( isset( $form['form_id'] ) ) {
$this->form_suffix = '-' . $form['form_id'];
$this->processing = $form['form_id'];
foreach( $form as $key => $value ){
foreach ( $form as $key => $value ) {
if ( strstr( $key, $this->form_suffix ) ) {
$a_key = str_replace( $this->form_suffix, '', $key );
$form[ $a_key ] = $value;