| @@ -1,8 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace AcyMailing\WpInit; |
| 4 | 4 | |
| 5 | +defined('ABSPATH') || die('Restricted Access'); | |
| 6 | + | |
| 5 | 7 | use AcyMailing\Classes\UserClass; |
| 6 | 8 | use AcyMailing\Classes\ListClass; |
| 7 | 9 | |
| 8 | 10 | class ElementorForm extends \ElementorPro\Modules\Forms\Classes\Action_Base |
| @@ -18,8 +20,10 @@ | ||
| 18 | 20 | } |
| 19 | 21 | |
| 20 | 22 | public function register_settings_section($widget) |
| 21 | 23 | { |
| 24 | + // Check if an id is provided because this function is called many times sometimes there is no id (and not the rest: settings, form_fields,...) | |
| 25 | + // So when we try to access fields data that is not currently existing a fatal error appears | |
| 22 | 26 | if ($widget->get_id()) { |
| 23 | 27 | $fields = ['' => '']; |
| 24 | 28 | foreach ($widget->get_data('settings')['form_fields'] as $field) { |
| 25 | 29 | if (!isset($field['custom_id']) || !isset($field['field_label'])) { |
| @@ -96,9 +100,9 @@ | ||
| 96 | 100 | $newUser = new \stdClass(); |
| 97 | 101 | |
| 98 | 102 | $newUser->name = $data[$settings['acym_nameField']]; |
| 99 | 103 | $newUser->email = $data[$settings['acym_emailField']]; |
| 100 | - $newUser->creation_date = date('Y-m-d H:i:s'); | |
| 104 | + $newUser->creation_date = gmdate('Y-m-d H:i:s'); | |
| 101 | 105 | $newUser->confirmed = $settings['acym_confirmUsers'] === 'yes'; |
| 102 | 106 | |
| 103 | 107 | $user = $userClass->getOneByEmail($newUser->email); |
| 104 | 108 | if (!empty($user)) { |
| @@ -104,8 +108,9 @@ | ||
| 104 | 108 | if (!empty($user)) { |
| 105 | 109 | $newUser->id = $user->id; |
| 106 | 110 | } |
| 107 | 111 | |
| 112 | + // We do that because Elementor submit the form via ajax and in ajax mode WordPress always return true to the function is_admin() | |
| 108 | 113 | $config = acym_config(); |
| 109 | 114 | if ($config->get('require_confirmation', 1) == 1) { |
| 110 | 115 | $userClass->forceConfAdmin = true; |
| 111 | 116 | } |