PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.3
3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 All 196 releases
← All changes | admin/class-convertkit-admin-category.php +16 -10 2.2.73.4.3 View file →
@@ -84,8 +84,11 @@
84 84
85 85 // Enqueue Category CSS.
86 86 wp_enqueue_style( 'convertkit-category', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/category.css', array(), CONVERTKIT_PLUGIN_VERSION );
87 87
88 + // Enqueue Refresh Resources CSS.
89 + wp_enqueue_style( 'convertkit-admin-refresh-resources', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/refresh-resources.css', array(), CONVERTKIT_PLUGIN_VERSION );
90 +
88 91 /**
89 92 * Enqueue CSS when editing a Category that outputs
90 93 * ConvertKit Plugin settings.
91 94 *
@@ -110,20 +113,15 @@
110 113 return false;
111 114 }
112 115
113 116 // Bail if we are not editing a Category.
114 - if ( ! function_exists( 'get_current_screen' ) ) {
117 + if ( convertkit_get_current_screen( 'id' ) !== 'edit-category' ) {
115 118 return false;
116 119 }
117 - $screen = get_current_screen();
118 120
119 - if ( $screen->id !== 'edit-category' ) {
120 - return false;
121 - }
122 -
123 121 // Bail if the API hasn't been configured.
124 122 $settings = new ConvertKit_Settings();
125 - if ( ! $settings->has_api_key_and_secret() ) {
123 + if ( ! $settings->has_access_and_refresh_token() ) {
126 124 return false;
127 125 }
128 126
129 127 return true;
@@ -137,9 +135,9 @@
137 135 public function add_category_form_fields() {
138 136
139 137 // Don't show the form fields if the API hasn't been configured.
140 138 $settings = new ConvertKit_Settings();
141 - if ( ! $settings->has_api_key_and_secret() ) {
139 + if ( ! $settings->has_access_and_refresh_token() ) {
142 140 return;
143 141 }
144 142
145 143 // Fetch Forms.
@@ -160,9 +158,9 @@
160 158 public function edit_category_form_fields( $term ) {
161 159
162 160 // Don't show the form fields if the API hasn't been configured.
163 161 $settings = new ConvertKit_Settings();
164 - if ( ! $settings->has_api_key_and_secret() ) {
162 + if ( ! $settings->has_access_and_refresh_token() ) {
165 163 return;
166 164 }
167 165
168 166 // Fetch Category Settings and Forms.
@@ -182,8 +180,13 @@
182 180 * @param int $term_id Term ID.
183 181 */
184 182 public function save_category_fields( $term_id ) {
185 183
184 + // Bail if the current user cannot edit this Category.
185 + if ( ! current_user_can( 'edit_term', $term_id ) ) {
186 + return;
187 + }
188 +
186 189 // Bail if no nonce field exists.
187 190 if ( ! isset( $_POST['wp-convertkit-save-meta-nonce'] ) ) {
188 191 return;
189 192 }
@@ -198,9 +201,12 @@
198 201 return;
199 202 }
200 203
201 204 // Build metadata.
202 - $meta = ( isset( $_POST['wp-convertkit']['form'] ) ? intval( $_POST['wp-convertkit']['form'] ) : '' );
205 + $meta = array(
206 + 'form' => ( isset( $_POST['wp-convertkit']['form'] ) ? intval( $_POST['wp-convertkit']['form'] ) : '' ),
207 + 'form_position' => ( isset( $_POST['wp-convertkit']['form_position'] ) ? sanitize_text_field( wp_unslash( $_POST['wp-convertkit']['form_position'] ) ) : '' ),
208 + );
203 209
204 210 // Save metadata.
205 211 $convertkit_term = new ConvertKit_Term( $term_id );
206 212 return $convertkit_term->save( $meta );