AI Verified

Name

Reorder Toolset field Timezone contents

About

<p>Takes a specific field added in Toolset and reorders the data. This was built to enable easier usage of a "Timezone" selector and could also be augmented to populate the correct data from PHP.</p>

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

NKDAgility

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: Not Specified

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

07/10/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Potential vulnerability found : Cross Site Scripting
Found on line : 34
Code : echo('<pre>'); print_r($options)
Vulnerable line : 36
Code : $options = $timezones);

Found 1 vulnerabilities

Reorder Toolset field Timezone contents

 
                    
1/**
2 * New custom code snippet (replace this with snippet description).
3 */
4 
5// Put the code of your snippet below this comment.
6add_filter( 'wpt_field_options', 'func_dynamic_populate', 10, 3);
7function func_dynamic_populate( $options, $title, $type ){
8//global $wpdb;
9 
10 switch( $title ){
11 case 'Training Timezone':
12 
13 
14 $OptionsArray = timezone_identifiers_list();
15 
16 $timezones = array(
17 array('#value' => '', '#title' => '----timezone----'),
18 array('#value' => 'Europe/London', '#title' => 'Europe/London'),
19 array('#value' => 'America/New_York', '#title' => 'America/New_York'),
20 array('#value' => 'America/Chicago', '#title' => 'America/Chicago'),
21 array('#value' => 'America/Los_Angeles', '#title' => 'America/Los_Angeles'),
22 array('#value' => 'UTC', '#title' => 'UTC')
23 );
24 
25 asort($timezones);
26 
27 foreach ($OptionsArray as $key => $value) {
28 $newtimezone = array('#value' => $value, '#title' => $value);
29 if (!in_array($newtimezone, $timezones))
30 {
31 $timezones[] = $newtimezone;
32 }
33 }
34 
35 //echo '<pre>'; print_r($options); echo '</pre>';
36 $options = $timezones;
37 break;
38 }
39 return $options;
40}

0

Related Snippets

Please see some snippets below related to this snippet..

General

Unverified

0

Elementor Gradients Headings

Added: 1 year ago

Last Updated: 11 months ago

CSS Code for background gradients on headings in Elementor

General

AI Verified

0

Display Post ID

Added: 9 months ago

Last Updated: 9 months ago

General

AI Verified

0

Make Gravity Forms Available to Editor Role

Added: 11 months ago

Last Updated: 11 months ago

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

General

AI Verified

0

Add Tickets Pro plain meta data on WooCommerce Order for Zapier

Added: 11 months ago

Last Updated: 11 months ago

Alters the Modern Tribe Tickets Pro meta data to a simpler format on the WooCommerse Order so that it's easier to integrate with other systems on Zapier.

General

AI Verified

General

AI Verified

0

Reorder Toolset field Timezone contents

Added: 11 months ago

Last Updated: 11 months ago

<p>Takes a specific field added in Toolset and reorders the data. This was built to enable easier usage of a "Timezone" selector and could also be augmented to populate the correct data from PHP.</p>