Completed
Pull Request — develop (#1577)
by Zack
18:22
created
includes/class-ajax.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @since 1.15
29 29
 	 * @param bool|false $mixed
30 30
 	 *
31
-	 * @return bool
31
+	 * @return boolean|null
32 32
 	 */
33 33
 	private function _exit( $mixed = NULL ) {
34 34
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * Import Gravity Form XML or JSON
201 201
 	 *
202 202
 	 * @param  string $xml_or_json_path Path to form XML or JSON file
203
-	 * @return int|bool       Imported form ID or false
203
+	 * @return false|string       Imported form ID or false
204 204
 	 */
205 205
 	function import_form( $xml_or_json_path = '' ) {
206 206
 
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
 		// template areas
140 140
 		$template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' );
141
-        $template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' );
141
+		$template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' );
142 142
 
143 143
 		// widget areas
144 144
 		$default_widget_areas = \GV\Widget::get_default_widget_areas();
@@ -331,40 +331,40 @@  discard block
 block discarded – undo
331 331
 		// load file
332 332
 		$xmlstr = file_get_contents( $form_file );
333 333
 
334
-        $options = array(
335
-            "page" => array("unserialize_as_array" => true),
336
-            "form"=> array("unserialize_as_array" => true),
337
-            "field"=> array("unserialize_as_array" => true),
338
-            "rule"=> array("unserialize_as_array" => true),
339
-            "choice"=> array("unserialize_as_array" => true),
340
-            "input"=> array("unserialize_as_array" => true),
341
-            "routing_item"=> array("unserialize_as_array" => true),
342
-            "creditCard"=> array("unserialize_as_array" => true),
343
-            "routin"=> array("unserialize_as_array" => true),
344
-            "confirmation" => array("unserialize_as_array" => true),
345
-            "notification" => array("unserialize_as_array" => true)
346
-        );
334
+		$options = array(
335
+			"page" => array("unserialize_as_array" => true),
336
+			"form"=> array("unserialize_as_array" => true),
337
+			"field"=> array("unserialize_as_array" => true),
338
+			"rule"=> array("unserialize_as_array" => true),
339
+			"choice"=> array("unserialize_as_array" => true),
340
+			"input"=> array("unserialize_as_array" => true),
341
+			"routing_item"=> array("unserialize_as_array" => true),
342
+			"creditCard"=> array("unserialize_as_array" => true),
343
+			"routin"=> array("unserialize_as_array" => true),
344
+			"confirmation" => array("unserialize_as_array" => true),
345
+			"notification" => array("unserialize_as_array" => true)
346
+		);
347 347
 
348 348
 		$xml = new RGXML($options);
349
-        $forms = $xml->unserialize($xmlstr);
349
+		$forms = $xml->unserialize($xmlstr);
350 350
 
351
-        if( !$forms ) {
352
-        	gravityview()->log->error( 'Importing Form Fields for preset [{template_id}]. Error importing file. (File) {path}', array( 'template_id' => $template_id, 'path' => $form_file ) );
353
-        	return false;
354
-        }
351
+		if( !$forms ) {
352
+			gravityview()->log->error( 'Importing Form Fields for preset [{template_id}]. Error importing file. (File) {path}', array( 'template_id' => $template_id, 'path' => $form_file ) );
353
+			return false;
354
+		}
355 355
 
356
-        if( !empty( $forms[0] ) && is_array( $forms[0] ) ) {
357
-        	$form = $forms[0];
358
-        }
356
+		if( !empty( $forms[0] ) && is_array( $forms[0] ) ) {
357
+			$form = $forms[0];
358
+		}
359 359
 
360
-        if( empty( $form ) ) {
361
-        	gravityview()->log->error( '$form not set.', array( 'data' => $forms ) );
362
-        	return false;
363
-        }
360
+		if( empty( $form ) ) {
361
+			gravityview()->log->error( '$form not set.', array( 'data' => $forms ) );
362
+			return false;
363
+		}
364 364
 
365
-        gravityview()->log->debug( '[pre_get_available_fields] Importing Form Fields for preset [{template_id}]. (Form)', array( 'template_id' => $template_id, 'data' => $form ) );
365
+		gravityview()->log->debug( '[pre_get_available_fields] Importing Form Fields for preset [{template_id}]. (Form)', array( 'template_id' => $template_id, 'data' => $form ) );
366 366
 
367
-        return $form;
367
+		return $form;
368 368
 
369 369
 	}
370 370
 
Please login to merge, or discard this patch.
includes/class-gravityview-admin-duplicate-view.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@
 block discarded – undo
195 195
 	 *
196 196
 	 * @since 1.6
197 197
 	 *
198
-	 * @param int $new_view_id The ID of the newly created View
198
+	 * @param int $new_id The ID of the newly created View
199 199
 	 * @param WP_Post $post The View that was just cloned
200 200
 	 *
201 201
 	 * @return void
Please login to merge, or discard this patch.
includes/class-gravityview-compatibility.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 
117 117
 	/**
118 118
 	 * @since 1.12
119
-	 * @return bool
119
+	 * @return boolean|null
120 120
 	 */
121 121
 	private function add_fallback_shortcode() {
122 122
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@
 block discarded – undo
240 240
 			self::$notices['wp_version'] = array(
241 241
 				'class' => 'error',
242 242
 				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ),
243
-			    'cap' => 'update_core',
243
+				'cap' => 'update_core',
244 244
 				'dismiss' => 'wp_version',
245 245
 			);
246 246
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-link-shortcode.php 1 patch
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -221,7 +221,6 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @since 1.15
223 223
 	 *
224
-	 * @param string|null $content Content inside shortcode, if defined
225 224
 	 *
226 225
 	 * @return string|boolean If URL is fetched, the URL to the entry link. If not found, returns false.
227 226
 	 */
@@ -316,7 +315,7 @@  discard block
 block discarded – undo
316 315
 	 *
317 316
 	 * @since 1.15
318 317
 	 *
319
-	 * @param string $href URL
318
+	 * @param string|null $url
320 319
 	 */
321 320
 	private function maybe_add_field_values_query_args( $url ) {
322 321
 
Please login to merge, or discard this patch.
includes/class-gravityview-roles-capabilities.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,6 @@
 block discarded – undo
67 67
 	 *
68 68
 	 * @since 1.15
69 69
 	 *
70
-	 * @param array   $allcaps An array of all the user's capabilities.
71 70
 	 * @param array   $caps    Actual capabilities for meta capability.
72 71
 	 * @param array   $args    Optional parameters passed to has_cap(), typically object ID.
73 72
 	 * @param WP_User|null $user    The user object, in WordPress 3.7.0 or higher
Please login to merge, or discard this patch.
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57 57
 		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58 58
 		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
59
+		add_action( 'admin_init', array( $this, 'add_caps') );
60 60
 	}
61 61
 
62 62
 
@@ -360,7 +360,6 @@  discard block
 block discarded – undo
360 360
 	 * Add Gravity Forms and GravityView's "full access" caps when any other caps are checked against.
361 361
 	 *
362 362
 	 * @since 1.15
363
-
364 363
 	 * @param array $caps_to_check
365 364
 	 *
366 365
 	 * @return array
Please login to merge, or discard this patch.
includes/class-gravityview-template.php 1 patch
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@  discard block
 block discarded – undo
37 37
 	public $active_areas;
38 38
 
39 39
 
40
+	/**
41
+	 * @param string $id
42
+	 */
40 43
 	function __construct( $id, $settings = array(), $field_options = array(), $areas = array() ) {
41 44
 
42 45
 		if ( empty( $id ) ) {
@@ -144,6 +147,9 @@  discard block
 block discarded – undo
144 147
 		return $areas;
145 148
 	}
146 149
 
150
+	/**
151
+	 * @param string $context
152
+	 */
147 153
 	public function get_active_areas( $context ) {
148 154
 		if ( isset( $this->active_areas[ $context ] ) ) {
149 155
 			return $this->active_areas[ $context ];
@@ -156,8 +162,8 @@  discard block
 block discarded – undo
156 162
 	/**
157 163
 	 * Assign template specific field options
158 164
 	 *
159
-	 * @param array $options (default: array())
160
-	 * @param string $template (default: '')
165
+	 * @param array $field_options (default: array())
166
+	 * @param string $template_id (default: '')
161 167
 	 * @param string $field_id key for the field
162 168
 	 * @param  string|array $context Context for the field; `directory` or `single` for example.
163 169
 	 *
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-admin.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,6 @@
 block discarded – undo
69 69
      * Change wording for the Edit context to read Entry Creator
70 70
      *
71 71
      * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
72
-     * @param  string      $field_type  Type of field options to render (`field` or `widget`)
73 72
      * @param  string      $template_id Table slug
74 73
      * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
75 74
      * @param  string      $context     What context are we in? Example: `single` or `directory`
Please login to merge, or discard this patch.
Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -10,42 +10,42 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 if ( ! defined( 'WPINC' ) ) {
13
-    die;
13
+	die;
14 14
 }
15 15
 
16 16
 
17 17
 class GravityView_Edit_Entry_Admin {
18 18
 
19
-    protected $loader;
19
+	protected $loader;
20 20
 
21
-    function __construct( GravityView_Edit_Entry $loader ) {
22
-        $this->loader = $loader;
23
-    }
21
+	function __construct( GravityView_Edit_Entry $loader ) {
22
+		$this->loader = $loader;
23
+	}
24 24
 
25
-    function load() {
25
+	function load() {
26 26
 
27
-        if( !is_admin() ) {
28
-            return;
29
-        }
27
+		if( !is_admin() ) {
28
+			return;
29
+		}
30 30
 
31
-        // Add Edit Link as a default field, outside those set in the Gravity Form form
32
-        add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
31
+		// Add Edit Link as a default field, outside those set in the Gravity Form form
32
+		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
33 33
 
34
-        // For the Edit Entry Link, you don't want visible to all users.
35
-        add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
34
+		// For the Edit Entry Link, you don't want visible to all users.
35
+		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
36 36
 
37
-        // Modify the field options based on the name of the field type
38
-        add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
37
+		// Modify the field options based on the name of the field type
38
+		add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
39 39
 
40
-        // add tooltips
41
-        add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
40
+		// add tooltips
41
+		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
42 42
 
43
-        // custom fields' options for zone EDIT
44
-        add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 );
43
+		// custom fields' options for zone EDIT
44
+		add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 );
45 45
 
46
-        // Add Edit Entry settings to View Settings
47
-        add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) );
48
-    }
46
+		// Add Edit Entry settings to View Settings
47
+		add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) );
48
+	}
49 49
 
50 50
 	/**
51 51
 	 * Render Edit Entry View metabox settings
@@ -69,101 +69,101 @@  discard block
 block discarded – undo
69 69
 		GravityView_Render_Settings::render_setting_row( 'edit_redirect_url', $current_settings );
70 70
 	}
71 71
 
72
-    /**
73
-     * Add Edit Link as a default field, outside those set in the Gravity Form form
74
-     * @param array $entry_default_fields Existing fields
75
-     * @param  string|array $form form_ID or form object
76
-     * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
77
-     */
78
-    function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
79
-
80
-        if( $zone !== 'edit' ) {
81
-
82
-            $entry_default_fields['edit_link'] = array(
83
-                'label' => __('Link to Edit Entry', 'gravityview'),
84
-                'type' => 'edit_link',
85
-                'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
86
-                'icon' => 'dashicons-welcome-write-blog',
87
-            );
88
-
89
-        }
90
-
91
-        return $entry_default_fields;
92
-    }
93
-
94
-    /**
95
-     * Change wording for the Edit context to read Entry Creator
96
-     *
97
-     * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
98
-     * @param  string      $field_type  Type of field options to render (`field` or `widget`)
99
-     * @param  string      $template_id Table slug
100
-     * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
101
-     * @param  string      $context     What context are we in? Example: `single` or `directory`
102
-     * @param  string      $input_type  (textarea, list, select, etc.)
103
-     * @return array                   Array of field options with `label`, `value`, `type`, `default` keys
104
-     */
105
-    function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
106
-
107
-        $caps = $visibility_caps;
108
-
109
-        // If we're configuring fields in the edit context, we want a limited selection
110
-        if( $context === 'edit' ) {
111
-
112
-            // Remove other built-in caps.
113
-            unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
114
-
115
-            $caps['read'] = _x('Entry Creator','User capability', 'gravityview');
116
-        }
117
-
118
-        return $caps;
119
-    }
120
-
121
-    /**
122
-     * Add "Edit Link Text" setting to the edit_link field settings
123
-     *
124
-     * @param array  $field_options
125
-     * @param string $template_id
126
-     * @param string $field_id
127
-     * @param string $context
128
-     * @param string $input_type
129
-     *
130
-     * @return array $field_options, with "Edit Link Text" field option
131
-     */
132
-    function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
133
-
134
-        // Always a link, never a filter
135
-        unset( $field_options['show_as_link'], $field_options['search_filter'] );
136
-
137
-        // Edit Entry link should only appear to visitors capable of editing entries
138
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
139
-
140
-        $add_option['edit_link'] = array(
141
-            'type' => 'text',
142
-            'label' => __( 'Edit Link Text', 'gravityview' ),
143
-            'desc' => NULL,
144
-            'value' => __('Edit Entry', 'gravityview'),
145
-            'merge_tags' => true,
146
-        );
147
-
148
-        return array_merge( $add_option, $field_options );
149
-    }
150
-
151
-    /**
152
-     * Add tooltips
153
-     * @param  array $tooltips Existing tooltips
154
-     * @return array           Modified tooltips
155
-     */
156
-    function tooltips( $tooltips ) {
157
-
158
-        $return = $tooltips;
159
-
160
-        $return['allow_edit_cap'] = array(
161
-            'title' => __('Limiting Edit Access', 'gravityview'),
162
-            'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
163
-        );
164
-
165
-        return $return;
166
-    }
72
+	/**
73
+	 * Add Edit Link as a default field, outside those set in the Gravity Form form
74
+	 * @param array $entry_default_fields Existing fields
75
+	 * @param  string|array $form form_ID or form object
76
+	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
77
+	 */
78
+	function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
79
+
80
+		if( $zone !== 'edit' ) {
81
+
82
+			$entry_default_fields['edit_link'] = array(
83
+				'label' => __('Link to Edit Entry', 'gravityview'),
84
+				'type' => 'edit_link',
85
+				'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
86
+				'icon' => 'dashicons-welcome-write-blog',
87
+			);
88
+
89
+		}
90
+
91
+		return $entry_default_fields;
92
+	}
93
+
94
+	/**
95
+	 * Change wording for the Edit context to read Entry Creator
96
+	 *
97
+	 * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
98
+	 * @param  string      $field_type  Type of field options to render (`field` or `widget`)
99
+	 * @param  string      $template_id Table slug
100
+	 * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
101
+	 * @param  string      $context     What context are we in? Example: `single` or `directory`
102
+	 * @param  string      $input_type  (textarea, list, select, etc.)
103
+	 * @return array                   Array of field options with `label`, `value`, `type`, `default` keys
104
+	 */
105
+	function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
106
+
107
+		$caps = $visibility_caps;
108
+
109
+		// If we're configuring fields in the edit context, we want a limited selection
110
+		if( $context === 'edit' ) {
111
+
112
+			// Remove other built-in caps.
113
+			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
114
+
115
+			$caps['read'] = _x('Entry Creator','User capability', 'gravityview');
116
+		}
117
+
118
+		return $caps;
119
+	}
120
+
121
+	/**
122
+	 * Add "Edit Link Text" setting to the edit_link field settings
123
+	 *
124
+	 * @param array  $field_options
125
+	 * @param string $template_id
126
+	 * @param string $field_id
127
+	 * @param string $context
128
+	 * @param string $input_type
129
+	 *
130
+	 * @return array $field_options, with "Edit Link Text" field option
131
+	 */
132
+	function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
133
+
134
+		// Always a link, never a filter
135
+		unset( $field_options['show_as_link'], $field_options['search_filter'] );
136
+
137
+		// Edit Entry link should only appear to visitors capable of editing entries
138
+		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
139
+
140
+		$add_option['edit_link'] = array(
141
+			'type' => 'text',
142
+			'label' => __( 'Edit Link Text', 'gravityview' ),
143
+			'desc' => NULL,
144
+			'value' => __('Edit Entry', 'gravityview'),
145
+			'merge_tags' => true,
146
+		);
147
+
148
+		return array_merge( $add_option, $field_options );
149
+	}
150
+
151
+	/**
152
+	 * Add tooltips
153
+	 * @param  array $tooltips Existing tooltips
154
+	 * @return array           Modified tooltips
155
+	 */
156
+	function tooltips( $tooltips ) {
157
+
158
+		$return = $tooltips;
159
+
160
+		$return['allow_edit_cap'] = array(
161
+			'title' => __('Limiting Edit Access', 'gravityview'),
162
+			'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
163
+		);
164
+
165
+		return $return;
166
+	}
167 167
 
168 168
 	/**
169 169
 	 * Add "Edit Link Text" setting to the edit_link field settings
@@ -179,28 +179,28 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
181 181
 
182
-        // We only want to modify the settings for the edit context
183
-        if( 'edit' !== $context ) {
184
-            return $field_options;
185
-        }
186
-
187
-        //  Entry field is only for logged in users
188
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
189
-
190
-        $add_options = array(
191
-            'allow_edit_cap' => array(
192
-                'type' => 'select',
193
-                'label' => __( 'Make field editable to:', 'gravityview' ),
194
-                'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
195
-                'tooltip' => 'allow_edit_cap',
196
-                'class' => 'widefat',
197
-                'value' => 'read', // Default: entry creator
198
-                'group' => 'visibility',
199
-            ),
200
-        );
201
-
202
-        return array_merge( $field_options, $add_options );
203
-    }
182
+		// We only want to modify the settings for the edit context
183
+		if( 'edit' !== $context ) {
184
+			return $field_options;
185
+		}
186
+
187
+		//  Entry field is only for logged in users
188
+		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
189
+
190
+		$add_options = array(
191
+			'allow_edit_cap' => array(
192
+				'type' => 'select',
193
+				'label' => __( 'Make field editable to:', 'gravityview' ),
194
+				'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
195
+				'tooltip' => 'allow_edit_cap',
196
+				'class' => 'widefat',
197
+				'value' => 'read', // Default: entry creator
198
+				'group' => 'visibility',
199
+			),
200
+		);
201
+
202
+		return array_merge( $field_options, $add_options );
203
+	}
204 204
 
205 205
 
206 206
 } // end class
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-user-registration.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      * @since 1.11
58 58
      *
59 59
      * @param array $form Gravity Forms form array
60
-     * @param string $entry_id Gravity Forms entry ID
60
+     * @param integer $entry_id Gravity Forms entry ID
61 61
      * @return void
62 62
      */
63 63
     public function update_user( $form = array(), $entry_id = 0 ) {
Please login to merge, or discard this patch.
Indentation   +262 added lines, -262 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 if ( ! defined( 'WPINC' ) ) {
14
-    die;
14
+	die;
15 15
 }
16 16
 
17 17
 /**
@@ -22,109 +22,109 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @var GravityView_Edit_Entry $loader
24 24
 	 */
25
-    protected $loader;
25
+	protected $loader;
26 26
 
27
-    /**
28
-     * @var WP_User|null Temporary storage used by restore_user_details()
29
-     */
30
-    private $_user_before_update = null;
27
+	/**
28
+	 * @var WP_User|null Temporary storage used by restore_user_details()
29
+	 */
30
+	private $_user_before_update = null;
31 31
 
32
-    function __construct( GravityView_Edit_Entry $loader ) {
33
-        $this->loader = $loader;
34
-    }
32
+	function __construct( GravityView_Edit_Entry $loader ) {
33
+		$this->loader = $loader;
34
+	}
35 35
 
36 36
 	/**
37 37
 	 * @since 1.11
38 38
 	 */
39 39
 	public function load() {
40 40
 		add_action( 'wp', array( $this, 'add_hooks' ), 10 );
41
-    }
41
+	}
42 42
 
43 43
 	/**
44 44
 	 * Add hooks to trigger updating the user
45 45
 	 *
46 46
 	 * @since 1.18
47 47
 	 */
48
-    public function add_hooks() {
49
-
50
-	    /**
51
-	     * @filter `gravityview/edit_entry/user_registration/trigger_update` Choose whether to update user information via User Registration add-on when an entry is updated?
52
-	     * @since 1.11
53
-	     * @param boolean $boolean Whether to trigger update on user registration (default: true)
54
-	     */
55
-	    if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56
-
57
-	    	add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
58
-
59
-		    // last resort in case the current user display name don't match any of the defaults
60
-		    add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
61
-	    }
62
-    }
63
-
64
-    /**
65
-     * Update the WordPress user profile based on the GF User Registration create feed
66
-     *
67
-     * @since 1.11
68
-     *
69
-     * @param array $form Gravity Forms form array
70
-     * @param string $entry_id Gravity Forms entry ID
71
-     * @return void
72
-     */
73
-    public function update_user( $form = array(), $entry_id = 0 ) {
74
-
75
-        if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
76
-	        gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' );
77
-	        return;
78
-        } elseif( empty( $entry_id ) ) {
79
-        	gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) );
80
-	        return;
81
-        }
82
-
83
-        $gf_user_registration = GF_User_Registration::get_instance();
84
-
85
-        $entry = GFAPI::get_entry( $entry_id );
86
-
87
-	    /**
88
-	     * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on
89
-	     * @since 1.11
90
-	     * @param array $entry Gravity Forms entry
91
-	     * @param array $form Gravity Forms form
92
-	     */
93
-        $entry = apply_filters( 'gravityview/edit_entry/user_registration/entry', $entry, $form );
94
-
95
-	    $config = $this->get_feed_configuration( $entry, $form );
96
-
97
-        // Make sure the feed is active
98
-	    if ( ! \GV\Utils::get( $config, 'is_active', false ) ) {
48
+	public function add_hooks() {
49
+
50
+		/**
51
+		 * @filter `gravityview/edit_entry/user_registration/trigger_update` Choose whether to update user information via User Registration add-on when an entry is updated?
52
+		 * @since 1.11
53
+		 * @param boolean $boolean Whether to trigger update on user registration (default: true)
54
+		 */
55
+		if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56
+
57
+			add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
58
+
59
+			// last resort in case the current user display name don't match any of the defaults
60
+			add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
61
+		}
62
+	}
63
+
64
+	/**
65
+	 * Update the WordPress user profile based on the GF User Registration create feed
66
+	 *
67
+	 * @since 1.11
68
+	 *
69
+	 * @param array $form Gravity Forms form array
70
+	 * @param string $entry_id Gravity Forms entry ID
71
+	 * @return void
72
+	 */
73
+	public function update_user( $form = array(), $entry_id = 0 ) {
74
+
75
+		if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) {
76
+			gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' );
99 77
 			return;
100
-	    }
78
+		} elseif( empty( $entry_id ) ) {
79
+			gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) );
80
+			return;
81
+		}
82
+
83
+		$gf_user_registration = GF_User_Registration::get_instance();
84
+
85
+		$entry = GFAPI::get_entry( $entry_id );
101 86
 
102
-	    // If an Update feed, make sure the conditions are met.
103
-	    if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) {
104
-	    	if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
105
-			    return;
106
-		    }
107
-	    }
87
+		/**
88
+		 * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on
89
+		 * @since 1.11
90
+		 * @param array $entry Gravity Forms entry
91
+		 * @param array $form Gravity Forms form
92
+		 */
93
+		$entry = apply_filters( 'gravityview/edit_entry/user_registration/entry', $entry, $form );
108 94
 
109
-	    // Do not update user if the user hasn't been registered (happens when manual activation is enabled in User Registration feed)
110
-	    $username = \GV\Utils::get( $config, 'meta/username', null );
111
-	    if ( ! isset( $entry[ $username ] ) || ! get_user_by( 'login', $entry[ $username ] ) ) {
112
-		    return;
113
-	    }
95
+		$config = $this->get_feed_configuration( $entry, $form );
96
+
97
+		// Make sure the feed is active
98
+		if ( ! \GV\Utils::get( $config, 'is_active', false ) ) {
99
+			return;
100
+		}
101
+
102
+		// If an Update feed, make sure the conditions are met.
103
+		if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) {
104
+			if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
105
+				return;
106
+			}
107
+		}
108
+
109
+		// Do not update user if the user hasn't been registered (happens when manual activation is enabled in User Registration feed)
110
+		$username = \GV\Utils::get( $config, 'meta/username', null );
111
+		if ( ! isset( $entry[ $username ] ) || ! get_user_by( 'login', $entry[ $username ] ) ) {
112
+			return;
113
+		}
114 114
 
115
-        // The priority is set to 3 so that default priority (10) will still override it
116
-        add_filter( 'send_password_change_email', '__return_false', 3 );
117
-        add_filter( 'send_email_change_email', '__return_false', 3 );
115
+		// The priority is set to 3 so that default priority (10) will still override it
116
+		add_filter( 'send_password_change_email', '__return_false', 3 );
117
+		add_filter( 'send_email_change_email', '__return_false', 3 );
118 118
 
119
-        // Trigger the User Registration update user method
120
-        $gf_user_registration->update_user( $entry, $form, $config );
119
+		// Trigger the User Registration update user method
120
+		$gf_user_registration->update_user( $entry, $form, $config );
121 121
 
122
-        remove_filter( 'send_password_change_email', '__return_false', 3 );
123
-        remove_filter( 'send_email_change_email', '__return_false', 3 );
122
+		remove_filter( 'send_password_change_email', '__return_false', 3 );
123
+		remove_filter( 'send_email_change_email', '__return_false', 3 );
124 124
 
125
-        // Prevent double-triggering by removing the hook
126
-	    remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 );
127
-    }
125
+		// Prevent double-triggering by removing the hook
126
+		remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 );
127
+	}
128 128
 
129 129
 	/**
130 130
 	 * Get the User Registration feed configuration for the entry & form
@@ -139,184 +139,184 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @return array
141 141
 	 */
142
-    public function get_feed_configuration( $entry, $form ) {
143
-
144
-	    $gf_user_registration = GF_User_Registration::get_instance();
145
-
146
-	    $config = $gf_user_registration->get_single_submission_feed( $entry, $form );
147
-
148
-	    /**
149
-	     * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed
150
-	     * @since 1.15
151
-	     * @param[in,out] boolean $preserve_role Preserve current user role Default: true
152
-	     * @param[in] array $config Gravity Forms User Registration feed configuration for the form
153
-	     * @param[in] array $form Gravity Forms form array
154
-	     * @param[in] array $entry Gravity Forms entry being edited
155
-	     */
156
-	    $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
157
-
158
-	    if( $preserve_role ) {
159
-		    $config['meta']['role'] = 'gfur_preserve_role';
160
-	    }
161
-
162
-	    $displayname = $this->match_current_display_name( $entry['created_by'] );
163
-
164
-	    /**
165
-	     * Make sure the current display name is not changed with the update user method.
166
-	     * @since 1.15
167
-	     */
168
-	    $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname'];
169
-
170
-	    /**
171
-	     * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
172
-	     * @since 1.14
173
-	     * @param[in,out] array $config Gravity Forms User Registration feed configuration for the form
174
-	     * @param[in] array $form Gravity Forms form array
175
-	     * @param[in] array $entry Gravity Forms entry being edited
176
-	     */
177
-	    $config = apply_filters( 'gravityview/edit_entry/user_registration/config', $config, $form, $entry );
178
-
179
-	    return $config;
180
-    }
181
-
182
-    /**
183
-     * Calculate the user display name format
184
-     *
185
-     * @since 1.15
186
-     * @since 1.20 Returns false if user not found at $user_id
187
-     *
188
-     * @param int $user_id WP User ID
189
-     * @return false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found.
190
-     */
191
-    public function match_current_display_name( $user_id ) {
192
-
193
-        $user = get_userdata( $user_id );
194
-
195
-        if( ! $user ) {
196
-        	return false;
197
-        }
198
-
199
-        $names = $this->generate_display_names( $user );
200
-
201
-        $format = array_search( $user->display_name, $names, true );
202
-
203
-        /**
204
-         * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook
205
-         * @see restore_display_name
206
-         */
207
-        if( false === $format ) {
208
-            $this->_user_before_update = $user;
209
-        }
210
-
211
-        return $format;
212
-    }
213
-
214
-    /**
215
-     * Generate an array of all the user display names possibilities
216
-     *
217
-     * @since 1.15
218
-     *
219
-     * @param object $profileuser WP_User object
220
-     * @return array List all the possible display names for a certain User object
221
-     */
222
-    public function generate_display_names( $profileuser ) {
223
-
224
-        $public_display = array();
225
-        $public_display['nickname']  = $profileuser->nickname;
226
-        $public_display['username']  = $profileuser->user_login;
227
-
228
-        if ( !empty($profileuser->first_name) ) {
229
-	        $public_display['firstname'] = $profileuser->first_name;
230
-        }
231
-
232
-        if ( !empty($profileuser->last_name) ) {
233
-	        $public_display['lastname'] = $profileuser->last_name;
234
-        }
235
-
236
-        if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
237
-            $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
238
-            $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
239
-        }
240
-
241
-        $public_display = array_map( 'trim', $public_display );
242
-        $public_display = array_unique( $public_display );
243
-
244
-        return $public_display;
245
-    }
246
-
247
-
248
-    /**
249
-     * Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon
250
-     *
251
-     * @see GFUser::update_user()
252
-     * @param int $user_id WP User ID that was updated by Gravity Forms User Registration Addon
253
-     * @param array $config Gravity Forms User Registration Addon form feed configuration
254
-     * @param array $entry The Gravity Forms entry that was just updated
255
-     * @param string $password User password
256
-     * @return int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process
257
-     */
258
-    public function restore_display_name( $user_id = 0, $config = array(), $entry = array(), $password = '' ) {
259
-
260
-        /**
261
-         * @filter `gravityview/edit_entry/restore_display_name` Whether display names should be restored to before updating an entry.
262
-         * Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed
263
-         * @since 1.14.4
264
-         * @param boolean $restore_display_name Restore Display Name? Default: true
265
-         */
266
-        $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
267
-
268
-        $is_update_feed = ( $config && \GV\Utils::get( $config, 'meta/feed_type' ) === 'update' );
269
-
270
-        /**
271
-         * Don't restore display name:
272
-         *   - either disabled,
273
-         *   - or it is an Update feed (we only care about Create feed)
274
-         *   - or we don't need as we found the correct format before updating user.
275
-         * @since 1.14.4
276
-         */
277
-        if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
278
-            return null;
279
-        }
280
-
281
-        $user_after_update = get_userdata( $user_id );
282
-
283
-        // User not found
284
-	    if ( ! $user_after_update ) {
285
-	    	gravityview()->log->error( 'User not found at $user_id #{user_id}', array( 'user_id' => $user_id ) );
286
-		    return false;
287
-	    }
288
-
289
-        $restored_user = $user_after_update;
290
-
291
-	    // Restore previous display_name
292
-        $restored_user->display_name = $this->_user_before_update->display_name;
293
-
294
-	    // Don't have WP update the password.
295
-	    unset( $restored_user->data->user_pass, $restored_user->user_pass );
296
-
297
-        /**
298
-         * Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView
299
-         * @since 1.14
300
-         * @param WP_User $restored_user The user with restored details about to be updated by wp_update_user()
301
-         * @param WP_User $user_before_update The user before being updated by Gravity Forms User Registration
302
-         * @param WP_User $user_after_update The user after being updated by Gravity Forms User Registration
303
-         * @param array   $entry The Gravity Forms entry that was just updated
304
-         */
305
-        $restored_user = apply_filters( 'gravityview/edit_entry/user_registration/restored_user', $restored_user, $this->_user_before_update, $user_after_update, $entry );
306
-
307
-        $updated = wp_update_user( $restored_user );
308
-
309
-        if( is_wp_error( $updated ) ) {
310
-            gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) );
311
-        } else {
312
-            gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) );
313
-        }
314
-
315
-        $this->_user_before_update = null;
316
-
317
-        unset( $restored_user, $user_after_update );
318
-
319
-        return $updated;
320
-    }
142
+	public function get_feed_configuration( $entry, $form ) {
143
+
144
+		$gf_user_registration = GF_User_Registration::get_instance();
145
+
146
+		$config = $gf_user_registration->get_single_submission_feed( $entry, $form );
147
+
148
+		/**
149
+		 * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed
150
+		 * @since 1.15
151
+		 * @param[in,out] boolean $preserve_role Preserve current user role Default: true
152
+		 * @param[in] array $config Gravity Forms User Registration feed configuration for the form
153
+		 * @param[in] array $form Gravity Forms form array
154
+		 * @param[in] array $entry Gravity Forms entry being edited
155
+		 */
156
+		$preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
157
+
158
+		if( $preserve_role ) {
159
+			$config['meta']['role'] = 'gfur_preserve_role';
160
+		}
161
+
162
+		$displayname = $this->match_current_display_name( $entry['created_by'] );
163
+
164
+		/**
165
+		 * Make sure the current display name is not changed with the update user method.
166
+		 * @since 1.15
167
+		 */
168
+		$config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname'];
169
+
170
+		/**
171
+		 * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
172
+		 * @since 1.14
173
+		 * @param[in,out] array $config Gravity Forms User Registration feed configuration for the form
174
+		 * @param[in] array $form Gravity Forms form array
175
+		 * @param[in] array $entry Gravity Forms entry being edited
176
+		 */
177
+		$config = apply_filters( 'gravityview/edit_entry/user_registration/config', $config, $form, $entry );
178
+
179
+		return $config;
180
+	}
181
+
182
+	/**
183
+	 * Calculate the user display name format
184
+	 *
185
+	 * @since 1.15
186
+	 * @since 1.20 Returns false if user not found at $user_id
187
+	 *
188
+	 * @param int $user_id WP User ID
189
+	 * @return false|string Display name format as used inside Gravity Forms User Registration. Returns false if user not found.
190
+	 */
191
+	public function match_current_display_name( $user_id ) {
192
+
193
+		$user = get_userdata( $user_id );
194
+
195
+		if( ! $user ) {
196
+			return false;
197
+		}
198
+
199
+		$names = $this->generate_display_names( $user );
200
+
201
+		$format = array_search( $user->display_name, $names, true );
202
+
203
+		/**
204
+		 * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook
205
+		 * @see restore_display_name
206
+		 */
207
+		if( false === $format ) {
208
+			$this->_user_before_update = $user;
209
+		}
210
+
211
+		return $format;
212
+	}
213
+
214
+	/**
215
+	 * Generate an array of all the user display names possibilities
216
+	 *
217
+	 * @since 1.15
218
+	 *
219
+	 * @param object $profileuser WP_User object
220
+	 * @return array List all the possible display names for a certain User object
221
+	 */
222
+	public function generate_display_names( $profileuser ) {
223
+
224
+		$public_display = array();
225
+		$public_display['nickname']  = $profileuser->nickname;
226
+		$public_display['username']  = $profileuser->user_login;
227
+
228
+		if ( !empty($profileuser->first_name) ) {
229
+			$public_display['firstname'] = $profileuser->first_name;
230
+		}
231
+
232
+		if ( !empty($profileuser->last_name) ) {
233
+			$public_display['lastname'] = $profileuser->last_name;
234
+		}
235
+
236
+		if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
237
+			$public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
238
+			$public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
239
+		}
240
+
241
+		$public_display = array_map( 'trim', $public_display );
242
+		$public_display = array_unique( $public_display );
243
+
244
+		return $public_display;
245
+	}
246
+
247
+
248
+	/**
249
+	 * Restore the Display Name and roles of a user after being updated by Gravity Forms User Registration Addon
250
+	 *
251
+	 * @see GFUser::update_user()
252
+	 * @param int $user_id WP User ID that was updated by Gravity Forms User Registration Addon
253
+	 * @param array $config Gravity Forms User Registration Addon form feed configuration
254
+	 * @param array $entry The Gravity Forms entry that was just updated
255
+	 * @param string $password User password
256
+	 * @return int|false|WP_Error|null True: User updated; False: $user_id not a valid User ID; WP_Error: User update error; Null: Method didn't process
257
+	 */
258
+	public function restore_display_name( $user_id = 0, $config = array(), $entry = array(), $password = '' ) {
259
+
260
+		/**
261
+		 * @filter `gravityview/edit_entry/restore_display_name` Whether display names should be restored to before updating an entry.
262
+		 * Otherwise, display names will be reset to the format specified in Gravity Forms User Registration "Update" feed
263
+		 * @since 1.14.4
264
+		 * @param boolean $restore_display_name Restore Display Name? Default: true
265
+		 */
266
+		$restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
267
+
268
+		$is_update_feed = ( $config && \GV\Utils::get( $config, 'meta/feed_type' ) === 'update' );
269
+
270
+		/**
271
+		 * Don't restore display name:
272
+		 *   - either disabled,
273
+		 *   - or it is an Update feed (we only care about Create feed)
274
+		 *   - or we don't need as we found the correct format before updating user.
275
+		 * @since 1.14.4
276
+		 */
277
+		if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
278
+			return null;
279
+		}
280
+
281
+		$user_after_update = get_userdata( $user_id );
282
+
283
+		// User not found
284
+		if ( ! $user_after_update ) {
285
+			gravityview()->log->error( 'User not found at $user_id #{user_id}', array( 'user_id' => $user_id ) );
286
+			return false;
287
+		}
288
+
289
+		$restored_user = $user_after_update;
290
+
291
+		// Restore previous display_name
292
+		$restored_user->display_name = $this->_user_before_update->display_name;
293
+
294
+		// Don't have WP update the password.
295
+		unset( $restored_user->data->user_pass, $restored_user->user_pass );
296
+
297
+		/**
298
+		 * Modify the user data after updated by Gravity Forms User Registration but before restored by GravityView
299
+		 * @since 1.14
300
+		 * @param WP_User $restored_user The user with restored details about to be updated by wp_update_user()
301
+		 * @param WP_User $user_before_update The user before being updated by Gravity Forms User Registration
302
+		 * @param WP_User $user_after_update The user after being updated by Gravity Forms User Registration
303
+		 * @param array   $entry The Gravity Forms entry that was just updated
304
+		 */
305
+		$restored_user = apply_filters( 'gravityview/edit_entry/user_registration/restored_user', $restored_user, $this->_user_before_update, $user_after_update, $entry );
306
+
307
+		$updated = wp_update_user( $restored_user );
308
+
309
+		if( is_wp_error( $updated ) ) {
310
+			gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) );
311
+		} else {
312
+			gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) );
313
+		}
314
+
315
+		$this->_user_before_update = null;
316
+
317
+		unset( $restored_user, $user_after_update );
318
+
319
+		return $updated;
320
+	}
321 321
 
322 322
 } //end class
Please login to merge, or discard this patch.
includes/admin/field-types/type_hidden.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 			return;
16 16
 		}
17 17
 
18
-        $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
18
+		$class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat';
19 19
 
20 20
 		?>
21 21
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" />
Please login to merge, or discard this patch.