Skip to content

Commit

Permalink
v 0.15.1
Browse files Browse the repository at this point in the history
- Custom callback for field validation.
  • Loading branch information
Darklg committed Sep 3, 2024
1 parent df0317c commit 9d585d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion inc/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ function wpu_extranet__correct_field($field, $field_id) {
'before_content' => '',
'after_content' => '',
'grid_start' => false,
'grid_end' => false
'grid_end' => false,
'callback_validation' => false,
);
$field = array_merge($defaults, $field);
if (!isset($field['options']) || !is_array($field['options'])) {
Expand Down Expand Up @@ -289,6 +290,11 @@ function wpu_extranet__save_fields($fields, $args = array()) {
continue;
}

if(isset($field['callback_validation']) && is_callable($field['callback_validation'])) {
$errors = call_user_func($field['callback_validation'], $errors, $field_id, $field, $value, $args);
}
$errors = apply_filters('wpu_extranet__save_fields__field', $errors, $field_id, $field, $value, $args);

if (!empty($errors)) {
break;
}
Expand Down
4 changes: 2 additions & 2 deletions wpu_extranet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/*
Plugin Name: WPU Extranet
Description: Simple toolbox to create an extranet or a customer account
Version: 0.15.0
Version: 0.15.1
Author: Darklg
Author URI: https://darklg.me/
Text Domain: wpu_extranet
Expand All @@ -18,7 +18,7 @@
Update URI: https://github.com/WordPressUtilities/wpu_extranet
*/

define('WPU_EXTRANET_VERSION', '0.15.0');
define('WPU_EXTRANET_VERSION', '0.15.1');

/* ----------------------------------------------------------
Settings
Expand Down

0 comments on commit 9d585d5

Please sign in to comment.