PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.19
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.19
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 +14 -17 6.276.19 View file →
@@ -9,9 +9,8 @@
9 9 class FrmFieldUserID extends FrmFieldType {
10 10
11 11 /**
12 12 * @var string
13 - *
14 13 * @since 3.0
15 14 */
16 15 protected $type = 'user_id';
17 16
@@ -16,9 +15,8 @@
16 15 protected $type = 'user_id';
17 16
18 17 /**
19 18 * @var bool
20 - *
21 19 * @since 3.0
22 20 */
23 21 protected $has_input = false;
24 22
@@ -23,9 +21,8 @@
23 21 protected $has_input = false;
24 22
25 23 /**
26 24 * @var bool
27 - *
28 25 * @since 3.0
29 26 */
30 27 protected $has_html = false;
31 28
@@ -30,9 +27,8 @@
30 27 protected $has_html = false;
31 28
32 29 /**
33 30 * @var bool
34 - *
35 31 * @since 3.0
36 32 */
37 33 protected $holds_email_values = true;
38 34
@@ -40,8 +36,9 @@
40 36 * @var bool
41 37 */
42 38 protected $array_allowed = false;
43 39
40 +
44 41 /**
45 42 * @return string
46 43 */
47 44 protected function include_form_builder_file() {
@@ -51,29 +48,24 @@
51 48 public function prepare_field_html( $args ) {
52 49 $args = $this->fill_display_field_values( $args );
53 50 $value = $this->get_field_value( $args );
54 51
55 - echo '<input type="hidden" name="' . esc_attr( $args['field_name'] ) . '" id="' . esc_attr( $args['html_id'] ) . '" value="' . esc_attr( $value ) . '" data-frmval="' . esc_attr( $value ) . '"/>' . "\n"; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
52 + echo '<input type="hidden" name="' . esc_attr( $args['field_name'] ) . '" id="' . esc_attr( $args['html_id'] ) . '" value="' . esc_attr( $value ) . '" data-frmval="' . esc_attr( $value ) . '"/>' . "\n";
56 53 }
57 54
58 55 /**
59 56 * @since 4.03.06
60 - *
61 - * @param array $args Field display arguments.
62 - *
63 - * @return int|string
64 57 */
65 58 protected function get_field_value( $args ) {
66 59 $user_ID = get_current_user_id();
67 - $user_ID = $user_ID ? $user_ID : '';
68 - $posted_value = FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
69 - $action = $args['action'] ?? $args['form_action'] ?? '';
60 + $user_ID = ( $user_ID ? $user_ID : '' );
61 + $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
62 + $action = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) );
70 63 $updating = $action === 'update';
71 64 return is_numeric( $this->field['value'] ) || $posted_value || $updating ? $this->field['value'] : $user_ID;
72 65 }
73 66
74 67 public function validate( $args ) {
75 - // phpcs:ignore Universal.Operators.StrictComparisons
76 68 if ( '' == $args['value'] ) {
77 69 return array();
78 70 }
79 71
@@ -96,8 +88,9 @@
96 88 * @return array|string A string is returned, but the return signature should match FrmFieldType.
97 89 */
98 90 protected function prepare_display_value( $value, $atts ) {
99 91 $user_info = $this->prepare_user_info_attribute( $atts );
92 +
100 93 return FrmFieldsHelper::get_user_display_name( $value, $user_info, $atts );
101 94 }
102 95
103 96 /**
@@ -112,12 +105,18 @@
112 105 * @return string
113 106 */
114 107 private function prepare_user_info_attribute( $atts ) {
115 108 if ( isset( $atts['show'] ) ) {
116 - return $atts['show'] === 'id' ? 'ID' : $atts['show'];
109 + if ( $atts['show'] === 'id' ) {
110 + $user_info = 'ID';
111 + } else {
112 + $user_info = $atts['show'];
113 + }
114 + } else {
115 + $user_info = apply_filters( 'frm_user_id_display', 'display_name' );
117 116 }
118 117
119 - return apply_filters( 'frm_user_id_display', 'display_name' );
118 + return $user_info;
120 119 }
121 120
122 121 /**
123 122 * @param string $value
@@ -130,10 +129,8 @@
130 129 }
131 130
132 131 /**
133 132 * @since 4.0.04
134 - *
135 - * @param mixed $value Field value passed by reference.
136 133 *
137 134 * @return void
138 135 */
139 136 public function sanitize_value( &$value ) {