Version Description
- Fixed minor bug causing a PHP warning (FILE)
- removed the restriction of not including scripts when a call is ajax
Download this release
Release Info
Developer | bradvin |
Plugin | Gravity Forms + Custom Post Types |
Version | 3.0.1 |
Comparing to | |
See all releases |
Code changes from version 3.0 to 3.0.1
- gfcptaddon.php +2 -2
- gfcptaddonbase.php +44 -46
- readme.txt +11 -7
gfcptaddon.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Gravity Forms + Custom Post Types
|
4 |
Plugin URI: http://themergency.com/plugins/gravity-forms-custom-post-types/
|
5 |
Description: Allows a simple way to map a Gravity Form post entry to a custom post type. Also include custom taxonomies.
|
6 |
-
Version: 3
|
7 |
Author: Brad Vincent
|
8 |
Author URI: http://themergency.com/
|
9 |
License: GPL2
|
@@ -59,7 +59,7 @@ class GFCPTAddon {
|
|
59 |
$gf_cpt_addon = new GFCPTAddon1_5();
|
60 |
|
61 |
//start me up!
|
62 |
-
$gf_cpt_addon->init(
|
63 |
}
|
64 |
}
|
65 |
|
3 |
Plugin Name: Gravity Forms + Custom Post Types
|
4 |
Plugin URI: http://themergency.com/plugins/gravity-forms-custom-post-types/
|
5 |
Description: Allows a simple way to map a Gravity Form post entry to a custom post type. Also include custom taxonomies.
|
6 |
+
Version: 3.0.1
|
7 |
Author: Brad Vincent
|
8 |
Author URI: http://themergency.com/
|
9 |
License: GPL2
|
59 |
$gf_cpt_addon = new GFCPTAddon1_5();
|
60 |
|
61 |
//start me up!
|
62 |
+
$gf_cpt_addon->init(__FILE__);
|
63 |
}
|
64 |
}
|
65 |
|
gfcptaddonbase.php
CHANGED
@@ -112,70 +112,68 @@ if (!class_exists('GFCPTAddonBase')) {
|
|
112 |
}
|
113 |
|
114 |
function enqueue_custom_scripts($form, $is_ajax) {
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
$saveToTaxonomy = $field['saveToTaxonomy'];
|
121 |
-
|
122 |
-
if (taxonomy_exists($saveToTaxonomy) && array_key_exists('taxonomyEnhanced', $field)) {
|
123 |
-
if ($field['taxonomyEnhanced']) {
|
124 |
|
125 |
-
|
|
|
126 |
|
127 |
-
|
128 |
|
129 |
-
|
130 |
|
131 |
-
|
132 |
-
//get the existing taxonomies and add them to an array to render later
|
133 |
-
$terms = get_terms($saveToTaxonomy, 'orderby=name&hide_empty=0&fields=names');
|
134 |
-
$this->_tag_terms[$saveToTaxonomy] = $terms;
|
135 |
-
}
|
136 |
|
137 |
-
|
|
|
|
|
|
|
|
|
138 |
|
139 |
-
|
140 |
-
$this->_included_js = true;
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
$src = plugins_url( 'css/custom/jquery-ui-1.8.16.custom.css' , __FILE__ ) );
|
145 |
-
wp_enqueue_style('gfcpt_jquery_ui_theme');
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
|
|
|
|
|
|
|
|
|
152 |
|
153 |
-
wp_register_script(
|
154 |
-
$handle = 'gfcpt_jquery_ui',
|
155 |
-
$src = plugins_url( 'js/jquery-ui-1.8.16.custom.min.js' , __FILE__ ),
|
156 |
-
$deps = array('jquery') );
|
157 |
|
158 |
-
|
|
|
|
|
|
|
159 |
|
160 |
-
|
161 |
-
$handle = 'gfcpt_tagit_js',
|
162 |
-
$src = plugins_url( 'js/tag-it.js' , __FILE__ ),
|
163 |
-
$deps = array('gfcpt_jquery_ui') );
|
164 |
|
165 |
-
|
|
|
|
|
|
|
166 |
|
167 |
-
|
168 |
-
$handle = 'gfcpt_tagit_init_js',
|
169 |
-
$src = plugins_url( 'js/tag-it.init.js' , __FILE__ ),
|
170 |
-
$deps = array('gfcpt_tagit_js') );
|
171 |
|
172 |
-
|
173 |
-
|
|
|
|
|
174 |
|
|
|
175 |
}
|
|
|
176 |
}
|
177 |
-
}
|
178 |
-
}
|
179 |
}
|
180 |
}
|
181 |
|
112 |
}
|
113 |
|
114 |
function enqueue_custom_scripts($form, $is_ajax) {
|
115 |
+
//loop thru all fields
|
116 |
+
foreach($form['fields'] as &$field) {
|
117 |
+
//if its a text field, see if we have set it to save to a taxonomy
|
118 |
+
if ($field['type'] == 'text' && array_key_exists('saveToTaxonomy', $field)) {
|
119 |
+
$saveToTaxonomy = $field['saveToTaxonomy'];
|
|
|
|
|
|
|
|
|
120 |
|
121 |
+
if (taxonomy_exists($saveToTaxonomy) && array_key_exists('taxonomyEnhanced', $field)) {
|
122 |
+
if ($field['taxonomyEnhanced']) {
|
123 |
|
124 |
+
$this->_has_tag_inputs = true;
|
125 |
|
126 |
+
$tag_input_id = '#input_'.$form['id'].'_'.$field['id'];
|
127 |
|
128 |
+
$this->_tag_inputs[$tag_input_id] = $saveToTaxonomy;
|
|
|
|
|
|
|
|
|
129 |
|
130 |
+
if ( !array_key_exists($saveToTaxonomy, $this->_tag_terms) ) {
|
131 |
+
//get the existing taxonomies and add them to an array to render later
|
132 |
+
$terms = get_terms($saveToTaxonomy, 'orderby=name&hide_empty=0&fields=names');
|
133 |
+
$this->_tag_terms[$saveToTaxonomy] = $terms;
|
134 |
+
}
|
135 |
|
136 |
+
if (!$this->_included_js) {
|
|
|
137 |
|
138 |
+
//enqueue some scripts for the enhaced UI
|
139 |
+
$this->_included_js = true;
|
|
|
|
|
140 |
|
141 |
+
wp_register_style(
|
142 |
+
$handle = 'gfcpt_jquery_ui_theme',
|
143 |
+
$src = plugins_url( 'css/custom/jquery-ui-1.8.16.custom.css' , __FILE__ ) );
|
144 |
+
wp_enqueue_style('gfcpt_jquery_ui_theme');
|
145 |
|
146 |
+
wp_register_style(
|
147 |
+
$handle = 'gfcpt_tagit_css',
|
148 |
+
$src = plugins_url( 'css/jquery.tagit.css' , __FILE__ ) );
|
149 |
+
wp_enqueue_style('gfcpt_tagit_css');
|
150 |
|
|
|
|
|
|
|
|
|
151 |
|
152 |
+
wp_register_script(
|
153 |
+
$handle = 'gfcpt_jquery_ui',
|
154 |
+
$src = plugins_url( 'js/jquery-ui-1.8.16.custom.min.js' , __FILE__ ),
|
155 |
+
$deps = array('jquery') );
|
156 |
|
157 |
+
wp_enqueue_script('gfcpt_jquery_ui');
|
|
|
|
|
|
|
158 |
|
159 |
+
wp_register_script(
|
160 |
+
$handle = 'gfcpt_tagit_js',
|
161 |
+
$src = plugins_url( 'js/tag-it.js' , __FILE__ ),
|
162 |
+
$deps = array('gfcpt_jquery_ui') );
|
163 |
|
164 |
+
wp_enqueue_script('gfcpt_tagit_js');
|
|
|
|
|
|
|
165 |
|
166 |
+
wp_register_script(
|
167 |
+
$handle = 'gfcpt_tagit_init_js',
|
168 |
+
$src = plugins_url( 'js/tag-it.init.js' , __FILE__ ),
|
169 |
+
$deps = array('gfcpt_tagit_js') );
|
170 |
|
171 |
+
wp_enqueue_script('gfcpt_tagit_init_js');
|
172 |
}
|
173 |
+
|
174 |
}
|
175 |
+
}
|
176 |
+
}
|
177 |
}
|
178 |
}
|
179 |
|
readme.txt
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
=== Gravity Forms + Custom Post Types ===
|
2 |
-
Contributors: bradvin
|
3 |
Donate link: http://themergency.com/donate/
|
4 |
Tags: form,forms,gravity,gravity form,gravity forms,CPT,custom post types,custom post type,taxonomy,taxonomies
|
5 |
-
Requires at least: 3.0
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag:
|
8 |
|
9 |
Easily map your forms that create posts to a custom post type. Also map dropdown select, radio buttons list and checkboxes lists to a custom taxonomy.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
> This plugin is an add-on for the
|
14 |
-
>
|
15 |
|
16 |
Gravity forms allows you to create posts from a form using 'post fields'. By default the submitted form will create a post, but I wanted a way to save a custom post type instead. It can be done quite easily with some php code, but I wanted it to be easier without any code at all. Now it is easy. Maybe too easy :)
|
17 |
|
@@ -63,6 +63,10 @@ You can now link the dropdown field to a post type and try to make it set the pa
|
|
63 |
|
64 |
== Changelog ==
|
65 |
|
|
|
|
|
|
|
|
|
66 |
= 3.0 =
|
67 |
* Removed support for Gravity Forms v1.4.5. Now supports v1.5 and up (including 1.6)
|
68 |
* Added support for single line text fields
|
@@ -88,7 +92,7 @@ You can now link the dropdown field to a post type and try to make it set the pa
|
|
88 |
== Frequently Asked Questions ==
|
89 |
|
90 |
= Does this plugin rely on anything? =
|
91 |
-
Yes, you need to install the [Gravity Forms Plugin](http://
|
92 |
|
93 |
== Upgrade Notice ==
|
94 |
|
1 |
=== Gravity Forms + Custom Post Types ===
|
2 |
+
Contributors: bradvin,wpsmith
|
3 |
Donate link: http://themergency.com/donate/
|
4 |
Tags: form,forms,gravity,gravity form,gravity forms,CPT,custom post types,custom post type,taxonomy,taxonomies
|
5 |
+
Requires at least: 3.0.1
|
6 |
+
Tested up to: 3.3.1
|
7 |
+
Stable tag: 3.0.1
|
8 |
|
9 |
Easily map your forms that create posts to a custom post type. Also map dropdown select, radio buttons list and checkboxes lists to a custom taxonomy.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
> This plugin is an add-on for the amazing *Gravity Forms Plugin*.
|
14 |
+
> Check out my other free [Add-ons for Gravity Forms](http://themergency.com/gravity-forms-addon-plugins/)
|
15 |
|
16 |
Gravity forms allows you to create posts from a form using 'post fields'. By default the submitted form will create a post, but I wanted a way to save a custom post type instead. It can be done quite easily with some php code, but I wanted it to be easier without any code at all. Now it is easy. Maybe too easy :)
|
17 |
|
63 |
|
64 |
== Changelog ==
|
65 |
|
66 |
+
= 3.0.1 =
|
67 |
+
* Fixed minor bug causing a PHP warning (_FILE_)
|
68 |
+
* removed the restriction of not including scripts when a call is ajax
|
69 |
+
|
70 |
= 3.0 =
|
71 |
* Removed support for Gravity Forms v1.4.5. Now supports v1.5 and up (including 1.6)
|
72 |
* Added support for single line text fields
|
92 |
== Frequently Asked Questions ==
|
93 |
|
94 |
= Does this plugin rely on anything? =
|
95 |
+
Yes, you need to install the [Gravity Forms Plugin](http://themergency.com/gravity-forms-addon-plugins/) for this plugin to work.
|
96 |
|
97 |
== Upgrade Notice ==
|
98 |
|