• Resolved lauramelos

    (@lauramelos)


    If I set a role in “Skip email verification for the selected user roles” it breaks the user table options to resend the verification. It seem to save an empty item on the excluded roles array meta value “cev_skip_verification_for_selected_roles”
    I found that the problem is how the data is saved on database here:
    customer-email-verification-for-woocommerce/includes/class-wc-customer-email-verification-admin.php Line 691

    if ( isset( $_POST[ $key ] ) ) {
    					
      foreach ( $val['options'] as $op_status => $op_data ) {
        $_POST[ $key ][$op_status] = 0;					
      }
      foreach ( wc_clean( $_POST[ $key ] ) as $key1 => $val ) {
        $_POST[ $key ][$val] = 1;									
      }	
      update_option( $key, wc_clean($_POST[ $key ]) );
    }

    And replaced with this (and avoid to change the $_POST)

    if ( isset( $_POST[ $key ] ) ) {
       $roles = array();
       foreach ( $val['options'] as $op_status => $op_data ) {
         $roles[ $key ][$op_status] = 0;
       }
    					
       foreach ( wc_clean( $_POST[ $key ] ) as $key1 => $val ) {
         $roles[ $key ][$val] = 1;									
       }	
       update_option( $key, wc_clean($roles[ $key ]) );
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fill the Selected user roles breaks users table actions’ is closed to new replies.