user-specific-messages.php
60 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Modules\Actions_V2\Register_User\Messages; |
| 5 | |
| 6 | use Jet_Form_Builder\Actions\Types\Base; |
| 7 | use Jet_Form_Builder\Form_Messages\Actions\Base_Action_Messages; |
| 8 | use JFB_Modules\Actions_V2\Register_User\Register_User_Action; |
| 9 | use JFB_Modules\Actions_V2\Update_User\Update_User_Action; |
| 10 | |
| 11 | // If this file is called directly, abort. |
| 12 | if ( ! defined( 'WPINC' ) ) { |
| 13 | die; |
| 14 | } |
| 15 | |
| 16 | class User_Specific_Messages extends Base_Action_Messages { |
| 17 | |
| 18 | public function is_supported( Base $action ): bool { |
| 19 | $current = get_class( $action ); |
| 20 | |
| 21 | return in_array( |
| 22 | $current, |
| 23 | array( |
| 24 | Register_User_Action::class, |
| 25 | Update_User_Action::class, |
| 26 | ), |
| 27 | true |
| 28 | ); |
| 29 | } |
| 30 | |
| 31 | protected function messages(): array { |
| 32 | return array( |
| 33 | 'password_mismatch' => array( |
| 34 | 'label' => __( 'Passwords mismatch', 'jet-form-builder' ), |
| 35 | 'value' => 'Passwords don\'t match.', |
| 36 | ), |
| 37 | 'email_exists' => array( |
| 38 | 'label' => __( 'Email exists', 'jet-form-builder' ), |
| 39 | 'value' => 'This email address is already used.', |
| 40 | ), |
| 41 | 'sanitize_user' => array( |
| 42 | 'label' => __( 'Incorrect user login', 'jet-form-builder' ), |
| 43 | 'value' => 'User login contains not allowed characters.', |
| 44 | ), |
| 45 | 'empty_username' => array( |
| 46 | 'label' => __( 'Empty user login', 'jet-form-builder' ), |
| 47 | 'value' => 'Please set user login.', |
| 48 | ), |
| 49 | 'empty_email' => array( |
| 50 | 'label' => __( 'Empty email', 'jet-form-builder' ), |
| 51 | 'value' => 'Please set user email.', |
| 52 | ), |
| 53 | 'incorrect_old_password' => array( |
| 54 | 'label' => __( 'Incorrect old password', 'jet-form-builder' ), |
| 55 | 'value' => 'The old password you entered is incorrect.', |
| 56 | ), |
| 57 | ); |
| 58 | } |
| 59 | } |
| 60 |