Commit 64aadb2f authored by Kevin Stover's avatar Kevin Stover

Merge branch 'release/v2.9'

parents c6696c8b b6a5ff69
......@@ -3,8 +3,8 @@
Tags: form, forms, contact form, custom form, form builder, form creator, form manager, form creation, contact forms, custom forms, forms builder, forms creator, forms manager, forms creation, form administration,
Requires at least: 3.8
Tested up to: 4.1
Stable tag: 2.8.13
Tested up to: 4.1.1
Stable tag: 2.9
License: GPLv2 or later
Forms created with a simple drag and drop interface. Contact forms, Email collection forms, or any other form you want on your WordPress site.
......
This diff is collapsed.
jQuery(document).ready(function($) {
var progressbar = $( "#progressbar" ),
progressLabel = $( ".progress-label" );
......@@ -22,36 +22,20 @@ jQuery(document).ready(function($) {
if ( nfProcessingAction != 'none' ) {
var nfProgressBar = {
labels: {
0: 'Lacing Our Tabis',
1: 'Cleaning The Dojo',
2: 'Doing Splits',
3: 'Buffing Bo Staff',
4: 'Intimidating Gaze',
5: 'Sparring',
6: 'Packing Smoke Bombs',
7: 'Polishing Shuriken',
8: 'Throwing Sais',
9: 'Calling Our Mom',
10: 'Practicing Katas',
11: 'Swinging Nunchucks',
12: 'Sharpening Swords',
13: 'Ironing Ninja Gi',
14: 'Eating Breakfast',
15: 'Cutting Stuff',
16: 'Doing Dishes',
17: 'Climbing Walls'
},
labels: nf_processing.step_labels,
currentLabel: 0,
getTextLabel: function() {
var label = this.labels[ this.currentLabel ];
return label;
},
changeTextLabel: function() {
var max = Object.keys( this.labels ).length - 1;
var labelNum = Math.floor( Math.random() * ( max - 2 + 1 ) ) + 2;
var max = Object.keys( this.labels ).length;
if ( max == 1 ) {
max = 0;
}
var labelNum = Math.floor( Math.random() * ( max - 2 + 1 ) ) + 1;
this.currentLabel = labelNum;
},
currentLabel: 0
}
};
var nfProcessing = {
......@@ -78,7 +62,7 @@ jQuery(document).ready(function($) {
} else {
progressbar.progressbar( "value", 100 );
if ( typeof response.redirect != 'undefined' && response.redirect != '' ) {
document.location.href = response.redirect;
//document.location.href = response.redirect;
}
}
});
......
This diff is collapsed.
<?php
// Silence is golden.
jQuery(document).ready(function(e){var t=e("#progressbar"),n=e(".progress-label");t.progressbar({value:false,change:function(){var e=parseInt(t.progressbar("value"));if(e==90){r.currentLabel=1}else if(e%10==0){r.changeTextLabel()}var i=r.getTextLabel();n.text(i+" "+t.progressbar("value")+"%")},complete:function(){n.text("Complete!")}});if(nfProcessingAction!="none"){var r={labels:{0:"Lacing Our Tabis",1:"Cleaning The Dojo",2:"Doing Splits",3:"Buffing Bo Staff",4:"Intimidating Gaze",5:"Sparring",6:"Packing Smoke Bombs",7:"Polishing Shuriken",8:"Throwing Sais",9:"Calling Our Mom",10:"Practicing Katas",11:"Swinging Nunchucks",12:"Sharpening Swords",13:"Ironing Ninja Gi",14:"Eating Breakfast",15:"Cutting Stuff",16:"Doing Dishes",17:"Climbing Walls"},getTextLabel:function(){var e=this.labels[this.currentLabel];return e},changeTextLabel:function(){var e=Object.keys(this.labels).length-1;var t=Math.floor(Math.random()*(e-2+1))+2;this.currentLabel=t},currentLabel:0};var i={setup:function(){this.interval=Math.floor(100/parseInt(this.totalSteps))},process:function(){e.post(ajaxurl,{step:this.step,total_steps:i.totalSteps,args:this.args,action:nfProcessingAction},function(n){n=e.parseJSON(n);i.step=n.step;i.totalSteps=n.total_steps;i.args=n.args;if(i.runSetup==1){i.setup();i.runSetup=0}if(!n.complete){i.progress();i.process()}else{t.progressbar("value",100);if(typeof n.redirect!="undefined"&&n.redirect!=""){document.location.href=n.redirect}}})},progress:function(){var e=t.progressbar("value")||0;t.progressbar("value",e+this.interval)},step:"loading",totalSteps:0,runSetup:1,interval:0,args:nfProcessingArgs};i.process()}})
\ No newline at end of file
jQuery(document).ready(function(e){var t=e("#progressbar"),n=e(".progress-label");t.progressbar({value:false,change:function(){var e=parseInt(t.progressbar("value"));if(e==90){r.currentLabel=1}else if(e%10==0){r.changeTextLabel()}var i=r.getTextLabel();n.text(i+" "+t.progressbar("value")+"%")},complete:function(){n.text("Complete!")}});if(nfProcessingAction!="none"){var r={labels:nf_processing.step_labels,getTextLabel:function(){var e=this.labels[this.currentLabel];return e},changeTextLabel:function(){var e=Object.keys(this.labels).length-1;var t=Math.floor(Math.random()*(e-2+1))+2;this.currentLabel=t},currentLabel:0};var i={setup:function(){this.interval=Math.floor(100/parseInt(this.totalSteps))},process:function(){e.post(ajaxurl,{step:this.step,total_steps:i.totalSteps,args:this.args,action:nfProcessingAction},function(n){n=e.parseJSON(n);i.step=n.step;i.totalSteps=n.total_steps;i.args=n.args;if(i.runSetup==1){i.setup();i.runSetup=0}if(!n.complete){i.progress();i.process()}else{t.progressbar("value",100);if(typeof n.redirect!="undefined"&&n.redirect!=""){document.location.href=n.redirect}}})},progress:function(){var e=t.progressbar("value")||0;t.progressbar("value",e+this.interval)},step:"loading",totalSteps:0,runSetup:1,interval:0,args:nfProcessingArgs};i.process()}})
\ No newline at end of file
......@@ -48,12 +48,60 @@ class NF_Form {
* @since 2.7
* @return void
*/
public function __construct( $form_id ) {
// Set our current form id.
$this->form_id = $form_id;
public function __construct( $form_id = '' ) {
if ( ! empty ( $form_id ) ) { // We've been passed a form id.
// Set our current form id.
$this->form_id = $form_id;
$this->update_fields();
$this->settings = nf_get_form_settings( $form_id );
}
}
/**
* Add a form
*
* @access public
* @since 2.9
* @return int $form_id
*/
public function create( $defaults = array() ) {
$form_id = nf_insert_object( 'form' );
$date_updated = date( 'Y-m-d', current_time( 'timestamp' ) );
nf_update_object_meta( $form_id, 'date_updated', $date_updated );
foreach( $defaults as $meta_key => $meta_value ) {
nf_update_object_meta( $form_id, $meta_key, $meta_value );
}
// Add a single event hook that will check to see if this is an orphaned function.
$timestamp = strtotime( '+24 hours', time() );
$args = array(
'form_id' => $form_id
);
wp_schedule_single_event( $timestamp, 'nf_maybe_delete_form', $args );
return $form_id;
}
/**
* Insert a field into our form
*
* @access public
* @since 2.9
* @return bool()
*/
public function insert_field( $field_id ) {
return nf_add_relationship( $field_id, 'field', $this->form_id, 'form' );
}
$this->fields = nf_get_fields_by_form_id( $form_id );
$this->settings = nf_get_form_settings( $form_id );
/**
* Update our fields
*
* @access public
* @since 2.9
* @return void
*/
public function update_fields() {
$this->fields = nf_get_fields_by_form_id( $this->form_id );
}
/**
......@@ -76,15 +124,28 @@ class NF_Form {
* Changes are only applied to this object.
*
* @access public
* @since 2.8
* @param string $setting
* @param mixed $value
* @return bool
*/
public function update_setting( $setting, $value ) {
$this->settings[ $setting ] = $value;
nf_update_object_meta( $this->form_id, $setting, $value );
return true;
}
/**
* Get all of our settings
*
* @access public
* @since 2.9
* @return array $settings
*/
public function get_all_settings() {
return $this->settings;
}
/**
* Get all the submissions for this form
*
......@@ -109,4 +170,18 @@ class NF_Form {
return count( $this->get_subs( $args ) );
}
/**
* Delete this form
*
* @access public
* @since 2.9
*/
public function delete() {
global $wpdb;
// Delete this object.
nf_delete_object( $this->form_id );
// Delete any fields on this form.
$wpdb->query($wpdb->prepare( "DELETE FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE form_id = %d", $this->form_id ) );
}
}
\ No newline at end of file
<?php
/**
* Handles adding and removing forms.
*
* @package Ninja Forms
* @subpackage Classes/Form
* @copyright Copyright (c) 2014, WPNINJAS
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 2.9
*/
class NF_Forms {
/**
* Store our array of form ids
*
* @since 2.9
*/
var $forms = array();
/**
* Get things started
*
* @access public
* @since 2.9
* @return void
*/
public function __construct() {
add_action( 'nf_maybe_delete_form', array( $this, 'maybe_delete' ) );
}
/**
* Get all forms
*
* @access public
* @since 2.9
* @return array $forms
*/
public function get_all( $debug = false, $show_new = false ) {
global $wpdb;
if ( empty ( $this->forms ) ) {
$forms = nf_get_objects_by_type( 'form' );
$tmp_array = array();
foreach ( $forms as $form ) {
$form_id = $form['id'];
$status = Ninja_Forms()->form( $form_id )->get_setting( 'status' );
if ( ( $status == 'new' && $show_new ) || $status != 'new' ) {
$title = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );
if ( strpos( $title, '_' ) === 0 ) {
if ( $debug )
$tmp_array[] = $form_id;
} else {
$tmp_array[] = $form_id;
}
}
}
$this->forms = $tmp_array;
}
return $this->forms;
}
/**
* Delete a form if it is created and not saved within 24 hrs.
*
* @access public
* @since 2.9
* @return void
*/
public function maybe_delete( $form_id ) {
$status = Ninja_Forms()->form( $form_id )->get_setting( 'status' );
if ( 'new' == $status ) {
Ninja_Forms()->form( $form_id )->delete();
}
}
/**
* Update cached forms
*
* @access public
* @since 2.9
* @return void
*/
public function update_cache( $debug = false, $show_new = false ) {
$this->forms = array();
$this->get_all( $debug, $show_new );
}
}
\ No newline at end of file
......@@ -31,8 +31,8 @@ class NF_Notification_Email extends NF_Notification_Base_Type
if ( $id == '' ) {
$email_format = 'html';
$from_name = '';
$from_address = '';
$from_name = get_bloginfo( 'name' );
$from_address = get_bloginfo( 'admin_email' );
$reply_to = '';
$to = '';
$cc = '';
......
......@@ -154,4 +154,17 @@ class NF_Notification
return true;
}
/**
* Get our notification type name
*
* @access public
* @since 2.9
* @return string $name
*/
public function type_name() {
$type = $this->type;
// Call our type edit screen.
return Ninja_Forms()->notification_types[ $type ]->name;
}
}
\ No newline at end of file
......@@ -86,6 +86,7 @@ class NF_Notifications_List_Table extends WP_List_Table {
public function column_default($item, $column_name){
switch($column_name){
case 'type':
return Ninja_Forms()->notification( $item['id'] )->type_name();
case 'date_updated':
return $item[$column_name];
default:
......
......@@ -75,7 +75,7 @@ class NF_Notifications
}
$args = array(
'name' => __( 'Notifications', 'ninja-forms' ),
'name' => __( 'Email & Actions', 'ninja-forms' ),
'page' => 'ninja-forms',
'display_function' => array( $this, 'output_admin' ),
'save_function' => array( $this, 'save_admin' ),
......@@ -216,7 +216,7 @@ class NF_Notifications
<?php
if ( '' == $action ) {
?>
<h2><?php _e( 'Notifications', 'ninja-forms' ); ?> <a href="<?php echo add_query_arg( array( 'notification-action' => 'new' ) ); ?>" class="add-new-h2"><?php _e( 'Add New', 'ninja-forms' );?></a></h2>
<h2><?php _e( 'Email & Actions', 'ninja-forms' ); ?> <a href="<?php echo add_query_arg( array( 'notification-action' => 'new' ) ); ?>" class="add-new-h2"><?php _e( 'Add New', 'ninja-forms' );?></a></h2>
<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
<form id="forms-filter" method="get">
......@@ -239,10 +239,10 @@ class NF_Notifications
if ( $id == '' ) {
$id = 'new';
$this_type = 'email';
$title = __( 'New Notification', 'ninja-forms' );
$title = __( 'New Action', 'ninja-forms' );
} else {
$this_type = Ninja_Forms()->notification( $id )->type;
$title = __( 'Edit Notification', 'ninja-forms' ) . ' - ID ' . $id;
$title = __( 'Edit Action', 'ninja-forms' ) . ' - ID ' . $id;
}
?>
......@@ -252,7 +252,7 @@ class NF_Notifications
<table class="form-table">
<tbody id="notification-main">
<tr>
<th scope="row"><label for="setting-name"><?php _e( 'Notification Name', 'ninja-forms' ); ?></label></th>
<th scope="row"><label for="setting-name"><?php _e( 'Action Name', 'ninja-forms' ); ?></label></th>
<td><input name="settings[name]" type="text" id="settings-name" value="<?php echo nf_get_object_meta_value( $id, 'name' ); ?>" class="regular-text"></td>
</tr>
<tr>
......@@ -330,12 +330,12 @@ class NF_Notifications
if ( $new ) {
$redirect = remove_query_arg( array( 'notification-action' ) );
$redirect = add_query_arg( array( 'id' => $n_id, 'notification-action' => 'edit' ), $redirect );
$redirect = add_query_arg( array( 'id' => $n_id, 'notification-action' => 'edit', 'update_message' => urlencode( __( 'Action Updated', 'ninja-forms' ) ) ), $redirect );
wp_redirect( $redirect );
die();
}
return __( 'Notification Updated', 'ninja-forms' );
return __( 'Action Updated', 'ninja-forms' );
}
/**
......
......@@ -274,6 +274,22 @@ class NF_Sub {
return $this->add_meta( $meta_key, $value );
}
/**
* Delete a meta value.
*
* @access public
* @since 2.9
* @return bool
*/
public function delete_meta( $meta_key, $value = '' ) {
if ( empty( $value ) ) {
return delete_post_meta( $this->sub_id, $meta_key );
} else {
return delete_post_meta( $this->sub_id, $meta_key, $value );
}
}
/**
* Add a field value to our submission.
*
......
......@@ -104,8 +104,16 @@ class NF_Subs_CPT {
} else {
$not_found = __( 'No Submissions Found', 'ninja-forms' );
}
$name = _x( 'Submissions', 'post type general name', 'ninja-forms' );
if ( ! empty ( $_REQUEST['form_id'] ) ) {
$form_title = Ninja_Forms()->form( $_REQUEST['form_id'] )->get_setting( 'form_title' );
$name =$name . ' - ' . $form_title;
}
$labels = array(
'name' => _x('Submissions', 'post type general name', 'ninja-forms' ),
'name' => $name,
'singular_name' => _x( 'Submission', 'post type singular name', 'ninja-forms' ),
'add_new' => _x( 'Add New', 'nf_sub' ),
'add_new_item' => __( 'Add New Submission', 'ninja-forms' ),
......@@ -270,24 +278,11 @@ class NF_Subs_CPT {
'cb' => '<input type="checkbox" />',
'id' => __( '#', 'ninja-forms' ),
);
/*
* This section uses the new Ninja Forms db structure. Until that is utilized, we must deal with the old db.
if ( isset ( $_GET['form_id'] ) ) {
$form_id = $_GET['form_id'];
$fields = nf_get_fields_by_form_id( $form_id );
if ( is_array ( $fields ) ) {
foreach ( $fields as $field_id => $setting ) {
if ( apply_filters( 'nf_add_sub_value', Ninja_Forms()->field( $field_id )->type->add_to_sub, $field_id ) )
$cols[ 'form_' . $form_id . '_field_' . $field_id ] = $setting['label'];
}
}
}
*/
// Compatibility with old field registration system. Can be removed when the new one is in place.
if ( isset ( $_GET['form_id'] ) && $_GET['form_id'] != '' ) {
$form_id = $_GET['form_id'];
if ( is_object( Ninja_Forms()->form( $form_id ) ) && is_array ( Ninja_Forms()->form( $form_id )->fields ) ) {
if ( is_object( Ninja_Forms()->form( $this->form_id ) ) && is_array ( Ninja_Forms()->form( $this->form_id )->fields ) ) {
foreach ( Ninja_Forms()->form( $this->form_id )->fields as $field ) {
$field_id = $field['id'];
$field_type = $field['type'];
......@@ -415,7 +410,7 @@ class NF_Subs_CPT {
$t_time = $h_time = __( 'Unpublished' );
$time_diff = 0;
} else {
$t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
$t_time = get_the_time( 'Y/m/d g:i:s A' );
$m_time = $post->post_date;
$time = get_post_time( 'G', true, $post );
......@@ -424,7 +419,7 @@ class NF_Subs_CPT {
if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
$h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
else
$h_time = mysql2date( __( 'Y/m/d' ), $m_time );
$h_time = mysql2date( 'Y/m/d', $m_time );
}
$t_time = apply_filters( 'nf_sub_title_time', $t_time );
......@@ -481,34 +476,9 @@ class NF_Subs_CPT {
if ( $typenow != 'nf_sub' )
return false;
/*
// Bail if we are looking at the trashed submissions.
if ( isset ( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'trash' )
return false;
*/
/*
* This section uses the new database structure for Ninja Forms. Until that structure is in place, we have to get data from the old db.
// Get our list of forms
$forms = nf_get_all_forms();
$form_id = isset( $_GET['form_id'] ) ? $_GET['form_id'] : '';
$html = '<select name="form_id" id="form_id">';
$html .= '<option value="">- Select a form</option>';
if ( is_array( $forms ) ) {
foreach ( $forms as $form ) {
$html .= '<option value="' . $form['id'] . '" ' . selected( $form['id'], $form_id, false ) . '>' . nf_get_form_setting( $form['id'], 'name' ) . '</option>';
}
}
$html .= '</select>';
echo $html;
*/
// Add our Form selection dropdown.
// Get our list of forms
$forms = ninja_forms_get_all_forms();
$forms = Ninja_Forms()->forms()->get_all();
$form_id = isset( $_GET['form_id'] ) ? $_GET['form_id'] : '';
......@@ -519,10 +489,11 @@ class NF_Subs_CPT {
$html = '<div style="float:left;">';
$html .= '<span style="float:left;" class="spinner"></span>';
$html .= '<select name="form_id" id="form_id" class="nf-form-jump">';
$html .= '<option value="">' . __( '- Select a form', 'ninja-forms' ) . '</option>';
$html .= '<option value="">- ' . __( 'Select a form', 'ninja-forms' ) . '</option>';
if ( is_array( $forms ) ) {
foreach ( $forms as $form ) {
$html .= '<option value="' . $form['id'] . '" ' . selected( $form['id'], $form_id, false ) . '>' . $form['data']['form_title'] . '</option>';
foreach ( $forms as $f_id ) {
$form_title = Ninja_Forms()->form( $f_id )->get_setting( 'form_title' );
$html .= '<option value="' . $f_id . '" ' . selected( $form_id, $f_id, false ) . '>' . $form_title . '</option>';
}
}
$html .= '</select>';
......@@ -627,9 +598,10 @@ class NF_Subs_CPT {
if (!empty($query)) {
// add to where clause
$pieces['where'] = str_replace("(((wp_posts.post_title LIKE '%", "( {$query} ((wp_posts.post_title LIKE '%", $pieces['where']);
$pieces['where'] = str_replace("((({$wpdb->posts}.post_title LIKE '%", "( {$query} (({$wpdb->posts}.post_title LIKE '%", $pieces['where']);
$pieces['join'] = $pieces['join'] . " INNER JOIN {$wpdb->postmeta} AS mypm1 ON ({$wpdb->posts}.ID = mypm1.post_id)";
}
}
return ($pieces);
......@@ -672,15 +644,15 @@ class NF_Subs_CPT {
$messages[$post_type] = array(
0 => '', // Unused. Messages start at index 1.
1 => $singular . ' ' . __( 'updated', 'ninja-forms' ) . '.',
2 => __('Custom field updated.'),
3 => __('Custom field deleted.'),
4 => __($singular.' updated.'),
5 => isset($_GET['revision']) ? sprintf( __($singular.' restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
6 => sprintf( __($singular.' published. <a href="%s">View '.strtolower($singular).'</a>'), esc_url( get_permalink($post_ID) ) ),
7 => __('Page saved.'),
8 => sprintf( __($singular.' submitted. <a target="_blank" href="%s">Preview '.strtolower($singular).'</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
9 => sprintf( __($singular.' scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview '.strtolower($singular).'</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
10 => sprintf( __($singular.' draft updated. <a target="_blank" href="%s">Preview '.strtolower($singular).'</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
2 => 'Custom field updated.',
3 => 'Custom field deleted.',
4 => $singular.' updated.',
5 => isset($_GET['revision']) ? sprintf( $singular.' restored to revision from %s', wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
6 => sprintf( $singular.' published. <a href="%s">View '.strtolower($singular).'</a>', esc_url( get_permalink($post_ID) ) ),
7 => 'Page saved.',
8 => sprintf( $singular.' submitted. <a target="_blank" href="%s">Preview '.strtolower($singular).'</a>', esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
9 => sprintf( $singular.' scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview '.strtolower($singular).'</a>', date_i18n( 'M j, Y @ G:i', strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
10 => sprintf( $singular.' draft updated. <a target="_blank" href="%s">Preview '.strtolower($singular).'</a>', esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
);
return $messages;
......@@ -1009,8 +981,7 @@ class NF_Subs_CPT {
}
$form_id = Ninja_Forms()->sub( $post->ID )->form_id;
$form = ninja_forms_get_form_by_id( $form_id );
$form_title = $form['data']['form_title'];
$form_title = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );
?>
<input type="hidden" name="nf_edit_sub" value="1">
<div class="submitbox" id="submitpost">
......@@ -1194,7 +1165,7 @@ class NF_Subs_CPT {
if ( isset ( $_REQUEST['export_single'] ) && ! empty( $_REQUEST['export_single'] ) )
Ninja_Forms()->sub( $_REQUEST['export_single'] )->export();
if ( isset ( $_REQUEST['action'] ) && $_REQUEST['action'] == 'export' )
if ( ( isset ( $_REQUEST['action'] ) && $_REQUEST['action'] == 'export' ) || ( isset ( $_REQUEST['action2'] ) && $_REQUEST['action2'] == 'export' ) )
Ninja_Forms()->subs()->export( $_REQUEST['post'] );
if ( isset ( $_REQUEST['download_file'] ) && ! empty( $_REQUEST['download_file'] ) ) {
......
......@@ -42,12 +42,8 @@ class NF_Subs {
Ninja_Forms()->sub( $sub_id )->update_form_id( $form_id );
// Get the current sequential ID
$form = ninja_forms_get_form_by_id( $form_id );
if ( isset ( $form['data']['last_sub'] ) ) {
$seq_num = $form['data']['last_sub'] + 1;
} else { // If we don't have a starting number, start at 1
$seq_num = 1;
}
$last_sub = Ninja_Forms()->form( $form_id )->get_setting( 'last_sub' );
$seq_num = ! empty ( $last_sub ) ? $last_sub + 1 : 1;
$seq_num = apply_filters( 'nf_sub_seq_num', $seq_num, $form_id );
......@@ -55,17 +51,7 @@ class NF_Subs {
Ninja_Forms()->sub( $sub_id )->update_seq_num( $seq_num );
// Update our form data with the new "last seq id."
$form['data']['last_sub'] = $seq_num;
$args = array(
'update_array' => array(
'data' => serialize( $form['data'] ),
),
'where' => array(
'id' => $form_id,
),
);
ninja_forms_update_form( $args );
Ninja_Forms()->form( $form_id )->update_setting( 'last_sub', $seq_num );
// Update our sub count
Ninja_Forms()->form( $form_id )->sub_count = $seq_num - 1;
......
This diff is collapsed.
......@@ -127,6 +127,10 @@ a.tooltip span
display: block;
}
.ninja-forms-field-error {
color: red;
}
.ninja-forms-form-wrap input,
.ninja-forms-form-wrap select ,
.ninja-forms-form-wrap textarea {
......
......@@ -69,15 +69,6 @@ function ninja_forms_activation( $network_wide ){
$opt = nf_pre_20_opts();
}
$sql = "CREATE TABLE IF NOT EXISTS ".NINJA_FORMS_TABLE_NAME." (
`id` int(11) NOT NULL AUTO_INCREMENT,
`data` longtext CHARACTER SET utf8 NOT NULL,
`date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 ;";
dbDelta($sql);
$sql = "CREATE TABLE IF NOT EXISTS ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." (
`id` int(11) NOT NULL AUTO_INCREMENT,