PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 3.06.06
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v3.06.06
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 +8 -35 6.43.06.06 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -if ( ! defined( 'ABSPATH' ) ) {
3 - die( 'You are not allowed to call this page directly.' );
4 -}
5 2
6 3 /**
7 4 * @since 3.0
8 5 */
@@ -32,14 +29,8 @@
32 29 */
33 30 protected $holds_email_values = true;
34 31
35 32 /**
36 - * @var bool
37 - */
38 - protected $array_allowed = false;
39 -
40 -
41 - /**
42 33 * @return string
43 34 */
44 35 protected function include_form_builder_file() {
45 36 return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-user-id.php';
@@ -45,26 +36,19 @@
45 36 return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-user-id.php';
46 37 }
47 38
48 39 public function prepare_field_html( $args ) {
49 - $args = $this->fill_display_field_values( $args );
50 - $value = $this->get_field_value( $args );
40 + $args = $this->fill_display_field_values( $args );
51 41
42 + $user_ID = get_current_user_id();
43 + $user_ID = ( $user_ID ? $user_ID : '' );
44 + $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // WPCS: CSRF ok.
45 + $updating = ( isset( $args['action'] ) && $args['action'] == 'update' );
46 + $value = ( is_numeric( $this->field['value'] ) || $posted_value || $updating ) ? $this->field['value'] : $user_ID;
47 +
52 48 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";
53 49 }
54 50
55 - /**
56 - * @since 4.03.06
57 - */
58 - protected function get_field_value( $args ) {
59 - $user_ID = get_current_user_id();
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'] : '' ) );
63 - $updating = $action == 'update';
64 - return ( is_numeric( $this->field['value'] ) || $posted_value || $updating ) ? $this->field['value'] : $user_ID;
65 - }
66 -
67 51 public function validate( $args ) {
68 52 if ( '' == $args['value'] ) {
69 53 return array();
70 54 }
@@ -88,9 +72,8 @@
88 72 * @return false|mixed|string
89 73 */
90 74 protected function prepare_display_value( $value, $atts ) {
91 75 $user_info = $this->prepare_user_info_attribute( $atts );
92 -
93 76 return FrmFieldsHelper::get_user_display_name( $value, $user_info, $atts );
94 77 }
95 78
96 79 /**
@@ -98,9 +81,8 @@
98 81 * a value from the user ID
99 82 * From the get_display_name() function
100 83 *
101 84 * @since 3.0
102 - *
103 85 * @param $atts
104 86 *
105 87 * @return string
106 88 */
@@ -111,9 +93,9 @@
111 93 } else {
112 94 $user_info = $atts['show'];
113 95 }
114 96 } else {
115 - $user_info = apply_filters( 'frm_user_id_display', 'display_name' );
97 + $user_info = 'display_name';
116 98 }
117 99
118 100 return $user_info;
119 101 }
@@ -125,15 +107,6 @@
125 107 * @return int
126 108 */
127 109 protected function prepare_import_value( $value, $atts ) {
128 110 return FrmAppHelper::get_user_id_param( trim( $value ) );
129 - }
130 -
131 - /**
132 - * @since 4.0.04
133 - *
134 - * @return void
135 - */
136 - public function sanitize_value( &$value ) {
137 - FrmAppHelper::sanitize_value( 'intval', $value );
138 111 }
139 112 }