PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.1
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/fields/FrmFieldUserID.php +11 -23 6.255.1 View file →
@@ -32,14 +32,8 @@
32 32 */
33 33 protected $holds_email_values = true;
34 34
35 35 /**
36 - * @var bool
37 - */
38 - protected $array_allowed = false;
39 -
40 -
41 - /**
42 36 * @return string
43 37 */
44 38 protected function include_form_builder_file() {
45 39 return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-user-id.php';
@@ -58,11 +52,11 @@
58 52 protected function get_field_value( $args ) {
59 53 $user_ID = get_current_user_id();
60 54 $user_ID = ( $user_ID ? $user_ID : '' );
61 55 $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
62 - $action = ( $args['action'] ?? $args['form_action'] ?? '' );
63 - $updating = $action === 'update';
64 - return is_numeric( $this->field['value'] ) || $posted_value || $updating ? $this->field['value'] : $user_ID;
56 + $action = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) );
57 + $updating = $action == 'update';
58 + return ( is_numeric( $this->field['value'] ) || $posted_value || $updating ) ? $this->field['value'] : $user_ID;
65 59 }
66 60
67 61 public function validate( $args ) {
68 62 if ( '' == $args['value'] ) {
@@ -68,15 +62,15 @@
68 62 if ( '' == $args['value'] ) {
69 63 return array();
70 64 }
71 65
72 - // Make sure we have a user ID.
66 + // make sure we have a user ID
73 67 if ( ! is_numeric( $args['value'] ) ) {
74 68 $args['value'] = FrmAppHelper::get_user_id_param( $args['value'] );
75 69 FrmEntriesHelper::set_posted_value( $this->field, $args['value'], $args );
76 70 }
77 71
78 - // Add user id to post variables to be saved with entry.
72 + //add user id to post variables to be saved with entry
79 73 $_POST['frm_user_id'] = $args['value'];
80 74
81 75 return array();
82 76 }
@@ -81,12 +75,12 @@
81 75 return array();
82 76 }
83 77
84 78 /**
85 - * @param array|string $value
86 - * @param array $atts
79 + * @param $value
80 + * @param $atts array
87 81 *
88 - * @return array|string A string is returned, but the return signature should match FrmFieldType.
82 + * @return false|mixed|string
89 83 */
90 84 protected function prepare_display_value( $value, $atts ) {
91 85 $user_info = $this->prepare_user_info_attribute( $atts );
92 86
@@ -99,9 +93,9 @@
99 93 * From the get_display_name() function
100 94 *
101 95 * @since 3.0
102 96 *
103 - * @param array $atts
97 + * @param $atts
104 98 *
105 99 * @return string
106 100 */
107 101 private function prepare_user_info_attribute( $atts ) {
@@ -118,10 +112,10 @@
118 112 return $user_info;
119 113 }
120 114
121 115 /**
122 - * @param string $value
123 - * @param array $atts
116 + * @param $value
117 + * @param $atts
124 118 *
125 119 * @return int
126 120 */
127 121 protected function prepare_import_value( $value, $atts ) {
@@ -129,15 +123,9 @@
129 123 }
130 124
131 125 /**
132 126 * @since 4.0.04
133 - *
134 - * @return void
135 127 */
136 128 public function sanitize_value( &$value ) {
137 - if ( '' === $value ) {
138 - // Allow for an empty User ID. Return early to prevent it from getting set to 0.
139 - return;
140 - }
141 129 FrmAppHelper::sanitize_value( 'intval', $value );
142 130 }
143 131 }