Skip to content

Commit 4464b74

Browse files
committed
Hide timezone field.
1 parent 561fd35 commit 4464b74

File tree

2 files changed

+12
-32
lines changed

2 files changed

+12
-32
lines changed

includes/admin/templates/create-account-page.php

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525
if ( ! empty( $api ) ) {
2626
$profile = $api->get( '' );
27-
$email = $profile['email'] ?? $email;
27+
if ( ! is_wp_error( $profile ) ) {
28+
$email = $profile['email'] ?? $email;
29+
}
2830
}
2931

3032
// Prepare data for prefilling the form.
@@ -209,29 +211,15 @@
209211
</div>
210212
</div>
211213
</div>
212-
213-
<div class="form-row">
214-
<div class="box">
215-
<label for="timezone">
216-
<span><?php esc_html_e( 'Timezone', 'mailchimp' ); ?></span>
217-
</label>
218-
<div class="mailchimp-select-wrapper">
219-
<select id="timezone" name="timezone" required>
220-
<?php
221-
$selected_timezone = $data['timezone'];
222-
foreach ( $timezones as $timezone ) {
223-
?>
224-
<option value="<?php echo esc_attr( $timezone['zone'] ); ?>" <?php selected( $timezone['zone'] === $selected_timezone, true ); ?>>
225-
<?php echo esc_html( $timezone['diff_from_GMT'] . ' - ' . $timezone['zone'] ); ?>
226-
</option>
227-
<?php
228-
}
229-
?>
230-
</select>
231-
</div>
232-
</div>
233-
</div>
234214
</fieldset>
215+
<?php
216+
$timezone = 'UTC';
217+
$selected_timezone = $data['timezone'];
218+
if ( in_array( $selected_timezone, $timezones, true ) ) {
219+
$timezone = $selected_timezone;
220+
}
221+
?>
222+
<input type="hidden" id="timezone" name="timezone" value="<?php echo esc_attr( $timezone ); ?>"/>
235223
</div>
236224
</div>
237225

includes/class-mailchimp-admin.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -474,15 +474,7 @@ public function create_account_page() {
474474
* @return array
475475
*/
476476
private function get_timezones() {
477-
$zones_array = array();
478-
foreach ( timezone_identifiers_list() as $key => $zone ) {
479-
$timezone = new DateTimeZone( $zone );
480-
$diff_string = ( new DateTime( 'now', $timezone ) )->format( 'P' );
481-
$zones_array[ $key ]['zone'] = $zone;
482-
$zones_array[ $key ]['diff_from_GMT'] = 'UTC/GMT ' . $diff_string;
483-
}
484-
485-
return $zones_array;
477+
return timezone_identifiers_list();
486478
}
487479

488480
/**

0 commit comments

Comments
 (0)