PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.4.7
JetFormBuilder — Dynamic Blocks Form Builder v3.4.7
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / actions-v2 / update-user / update-user-action.php
jetformbuilder / modules / actions-v2 / update-user Last commit date
assets 1 year ago properties 1 year ago update-user-action.php 1 year ago update-user.php 1 year ago
update-user-action.php
82 lines
1 <?php
2
3 namespace JFB_Modules\Actions_V2\Update_User;
4
5 use Jet_Form_Builder\Actions\Action_Handler;
6 use JFB_Modules\Actions_V2\Update_User\Properties\User_Modifier;
7 use Jet_Form_Builder\Actions\Types\Base;
8 use Jet_Form_Builder\Classes\Arrayable\Array_Tools;
9 use Jet_Form_Builder\Classes\Tools;
10 use Jet_Form_Builder\Exceptions\Action_Exception;
11
12 // If this file is called directly, abort.
13 if ( ! defined( 'WPINC' ) ) {
14 die;
15 }
16
17 /**
18 * Define Base_Type class
19 */
20 class Update_User_Action extends Base {
21
22 public function get_name() {
23 return __( 'Update User', 'jet-form-builder' );
24 }
25
26 public function get_id() {
27 return 'update_user';
28 }
29
30 public function action_attributes() {
31 return array(
32 'fields_map' => array(
33 'default' => array(),
34 ),
35 'user_role' => array(
36 'default' => '',
37 ),
38 );
39 }
40
41 /**
42 * @param array $request
43 * @param Action_Handler $handler
44 *
45 * @return void
46 * @throws Action_Exception
47 */
48 public function do_action( array $request, Action_Handler $handler ) {
49 ( new User_Modifier() )
50 ->set_request( $request )
51 ->set_fields_map( $this->settings['fields_map'] ?? array() )
52 ->set( 'role', $this->settings['user_role'] ?? false )
53 ->run();
54 }
55
56 public function self_script_name() {
57 return 'jetFormUpdateUserData';
58 }
59
60 public function editor_labels() {
61 return array(
62 'fields_map' => __( 'Fields Map:', 'jet-form-builder' ),
63 'user_role' => __( 'User Role:', 'jet-form-builder' ),
64 );
65 }
66
67 /**
68 * Regsiter custom action data for the editor
69 *
70 * @return [type] [description]
71 */
72 public function action_data() {
73 return array(
74 'userRoles' => Tools::get_user_roles_for_js(),
75 'properties' => Tools::with_placeholder(
76 Array_Tools::to_array( ( new User_Modifier() )->properties->all() )
77 ),
78 );
79 }
80
81 }
82