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