Commit 97888072 authored by Kevin Stover's avatar Kevin Stover

Merge branch 'release/v2.8.2'

parents 7b458534 7839a0f8
......@@ -242,6 +242,14 @@ class NF_Notification_Email extends NF_Notification_Base_Type
$cc = $this->process_setting( $id, 'cc' );
$bcc = $this->process_setting( $id, 'bcc' );
if ( empty ( $from_name ) )
$from_name = 'WordPress';
if ( empty ( $from_address ) ) {
$admin_email = get_bloginfo( 'admin_email' );
$from_address = $admin_email;
}
$email_from = $from_name.' <'.$from_address.'>';
$subject = $this->process_setting( $id, 'email_subject' );
......@@ -253,9 +261,11 @@ class NF_Notification_Email extends NF_Notification_Base_Type
$message = $this->process_setting( $id, 'email_message' );
$message = $message[0];
if ( $email_format != 'plain' ) {
if ( $email_format != 'plain' )
$message = apply_filters( 'ninja_forms_admin_email_message_wpautop', wpautop( $message ) );
}
if ( empty ( $message ) )
$message = ' ';
$headers = array();
$headers[] = 'From: ' . $email_from;
......
......@@ -71,7 +71,7 @@ class NF_Notification_Success_Message extends NF_Notification_Base_Type
public function process( $id ) {
global $ninja_forms_processing;
$success_msg = Ninja_Forms()->notification( $id )->get_setting( 'success_msg' );
$success_msg = apply_filters( 'nf_success_msg', Ninja_Forms()->notification( $id )->get_setting( 'success_msg' ), $id );
$success_msg = do_shortcode( wpautop( $success_msg ) );
$ninja_forms_processing->add_success_msg( 'success_msg', $success_msg );
}
......
......@@ -183,6 +183,8 @@ class NF_Subs {
// Add our "Date" label.
$label_array[0]['_date_submitted'] = __( 'Date Submitted', 'ninja-forms' );
$label_array = apply_filters( 'nf_subs_csv_label_array_before_fields', $label_array, $sub_ids );
foreach ( $fields as $field_id => $field ) {
// Get our field type
$field_type = $field['type'];
......
......@@ -203,7 +203,7 @@ function ninja_forms_activation( $network_wide ){
ninja_forms_add_starter_form();
}
update_option( 'nf_convert_notifications_complete', true);
update_option( 'nf_convert_notifications_complete', true );
update_option( 'nf_convert_subs_step', 'complete' );
update_option( 'nf_upgrade_notice', 'closed' );
......
......@@ -5,7 +5,7 @@ function ninja_forms_add_menu(){
$all_forms = add_submenu_page("ninja-forms", __( 'Forms', 'ninja-forms' ), __( 'All Forms', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_all_forms_capabilities', 'manage_options' ), "ninja-forms", "ninja_forms_admin");
$new_form = add_submenu_page("ninja-forms", __( 'Add New', 'ninja-forms' ), __( 'Add New', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_add_new_capabilities', 'manage_options' ), "ninja-forms&tab=form_settings&form_id=new", "ninja_forms_admin");
// $upgrade = add_submenu_page( null, __( 'Ninja Forms Upgrades', 'ninja-forms' ), __( 'Upgrades', 'ninja-forms' ), 'install_plugins', 'nf-upgrades', 'nf_upgrades_screen' );
$upgrade = add_submenu_page( null, __( 'Ninja Forms Upgrades', 'ninja-forms' ), __( 'Upgrades', 'ninja-forms' ), 'install_plugins', 'nf-upgrades', 'nf_upgrades_screen' );
add_action('admin_print_styles-' . $page, 'ninja_forms_admin_css');
add_action('admin_print_styles-' . $page, 'ninja_forms_admin_js');
......
......@@ -222,7 +222,7 @@ function ninja_forms_edit_field_output_li( $field_id ) {
* If we're submitting via ajax, we'll need to use this list.
*/
if ( isset ( $_POST['action'] ) && $_POST['action'] == 'ninja_forms_new_field' ) {
if ( ! empty ( $nf_rte_editors ) ) {
if ( ! empty ( $nf_rte_editors ) && isset ( $editors ) && is_object( $editors ) ) {
$editors->output_js( $field_id, $nf_rte_editors );
}
}
......
......@@ -9,6 +9,7 @@ class NF_Convert_Notifications extends NF_Step_Processing {
}
public function loading() {
global $wpdb;
/**
* Add our table structure for version 2.8.
......
......@@ -60,7 +60,11 @@ class NF_Convert_Subs {
public function count_old_subs() {
global $wpdb;
$count = $wpdb->get_results( 'SELECT COUNT(*) FROM '. NINJA_FORMS_SUBS_TABLE_NAME . ' WHERE `action` != "mp_save"', ARRAY_A );
return $count[0]['COUNT(*)'];
if ( is_array ( $count ) && ! empty ( $count ) ) {
return $count[0]['COUNT(*)'];
} else {
return false;
}
}
......
<?php
class NF_Update_Email_Settings extends NF_Step_Processing {
function __construct() {
$this->action = 'update_email_settings';
parent::__construct();
}
public function loading() {
global $wpdb;
// Get our total number of forms.
$form_count = nf_get_form_count();
// Get all our forms
$forms = ninja_forms_get_all_forms( true );
$x = 1;
if ( is_array( $forms ) ) {
foreach ( $forms as $form ) {
$this->args['forms'][$x] = $form['id'];
$x++;
}
}
if( empty( $this->total_steps ) || $this->total_steps <= 1 ) {
$this->total_steps = $form_count;
}
$args = array(
'total_steps' => $this->total_steps,
'step' => 1,
);
$this->redirect = admin_url( 'admin.php?page=ninja-forms' );
return $args;
}
public function step() {
global $ninja_forms_fields;
// Get our form ID
$form_id = $this->args['forms'][ $this->step ];
$fields = Ninja_Forms()->form( $form_id )->fields;
// Create a notification for our user email
if ( ! empty ( $fields ) ) {
foreach ( $fields as $field_id => $field ) {
if ( isset ( $field['data']['send_email'] ) && $field['data']['send_email'] == 1 ) {
// Add this field to our $addresses variable.
unset( $field['data']['send_email'] );
unset( $field['data']['replyto_email'] );
unset( $field['data']['from_name'] );
$args = array(
'update_array' => array(
'data' => serialize( $field['data'] ),
),
'where' => array(
'id' => $field_id,
),
);
ninja_forms_update_field( $args );
}
}
}
}
public function complete() {
update_option( 'nf_update_email_settings_complete', true );
}
}
\ No newline at end of file
......@@ -33,6 +33,15 @@ function nf_show_upgrade_notices() {
);
}
$update_email_settings_complete = get_option( 'nf_update_email_settings_complete', false );
if ( $n_conversion_complete && ! $update_email_settings_complete ) {
printf(
'<div class="update-nag"><p>' . __( 'Ninja Forms needs to update your email settings, click <a href="%s">here</a> to start the upgrade.', 'ninja-forms' ) . '</p></div>',
admin_url( 'index.php?page=nf-processing&action=update_email_settings' )
);
}
if ( isset( $_GET['page'] ) && $_GET['page'] == 'nf-upgrades' )
return; // Don't show notices on the upgrades page
......
......@@ -784,3 +784,10 @@ function nf_deprecate_all_fields_email_table( $value, $form_id ) {
}
add_filter( 'nf_all_fields_table', 'nf_deprecate_all_fields_email_table', 10, 2 );
// Deprecate our old success message filter
function nf_deprecate_success_message_filter( $message, $n_id ) {
return apply_filters( 'ninja_forms_success_msg', $message );
}
add_filter( 'nf_success_msg', 'nf_deprecate_success_message_filter', 10, 2 );
\ No newline at end of file
This diff is collapsed.
......@@ -3,7 +3,7 @@
Plugin Name: Ninja Forms
Plugin URI: http://ninjaforms.com/
Description: Ninja Forms is a webform builder with unparalleled ease of use and features.
Version: 2.8.1
Version: 2.8.2
Author: The WP Ninjas
Author URI: http://ninjaforms.com
Text Domain: ninja-forms
......@@ -129,6 +129,7 @@ class Ninja_Forms {
self::$instance->step_processing = new NF_Step_Processing();
self::$instance->download_all_subs = new NF_Download_All_Subs();
self::$instance->convert_notifications = new NF_Convert_Notifications();
self::$instance->update_email_settings = new NF_Update_Email_Settings();
}
}
......@@ -266,7 +267,7 @@ class Ninja_Forms {
// Plugin version
if ( ! defined( 'NF_PLUGIN_VERSION' ) )
define( 'NF_PLUGIN_VERSION', '2.8.1' );
define( 'NF_PLUGIN_VERSION', '2.8.2' );
// Plugin Folder Path
if ( ! defined( 'NF_PLUGIN_DIR' ) )
......@@ -369,13 +370,15 @@ class Ninja_Forms {
// Include our download all submissions php files
require_once( NF_PLUGIN_DIR . 'classes/download-all-subs.php' );
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/convert-notifications.php' );
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/update-email-settings.php' );
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php' );
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/convert-subs.php' );
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php' );
}
// Include our upgrade files.
require_once( NF_PLUGIN_DIR . 'includes/admin/welcome.php' );
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php' );
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php' );
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/convert-subs.php' );
// Include deprecated functions and filters.
require_once( NF_PLUGIN_DIR . 'includes/deprecated.php' );
......
......@@ -3,7 +3,7 @@ Contributors: kstover, jameslaws, daveshine, mordauk, bftrick, helgatheviking
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.0
Stable tag: 2.8
Stable tag: 2.8.2
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.
......@@ -76,15 +76,24 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
== Upgrade Notice ==
= 2.8.1 (14 September 2014 ) =
= 2.8.2 (16 September 2014 ) =
*Bugs:*
* Fixed a bug that could cause emails to be sent to the user's email address, even if a notification wasn't active.
* Fixed a bug that could prevent emails from being sent if the message was empty.
* Fixed a bug with upgrades that caused submission conversion to fail.
* Fixed PHP notices.
*Security:*
* Version 2.8 fixes a minor security issue that could allow non-admins and other forms to delete Ninja Forms. This won't affect all users, but we encourage everyone to update.
* Version 2.8 fixes a minor security issue that could allow non-admins and other forms to delete Ninja Forms. This won't affect all users, but we encourage everyone to update.
*Changes:*
* Added a filter for success message notifications: nf_success_msg.
* Added a filter for CSV exports after labels have been added but before fields: nf_subs_csv_label_array_before_fields.
* Deprecated the old version of the success message filter.
== Requested Features ==
......@@ -92,6 +101,25 @@ If you have any feature requests, please feel free to visit [ninjaforms.com](htt
== Changelog ==
= 2.8.2 (16 September 2014 ) =
*Bugs:*
* Fixed a bug that could cause emails to be sent to the user's email address, even if a notification wasn't active.
* Fixed a bug that could prevent emails from being sent if the message was empty.
* Fixed a bug with upgrades that caused submission conversion to fail.
* Fixed PHP notices.
*Security:*
* Version 2.8 fixes a minor security issue that could allow non-admins and other forms to delete Ninja Forms. This won't affect all users, but we encourage everyone to update.
*Changes:*
* Added a filter for success message notifications: nf_success_msg.
* Added a filter for CSV exports after labels have been added but before fields: nf_subs_csv_label_array_before_fields.
* Deprecated the old version of the success message filter.
= 2.8.1 (14 September 2014 ) =
*Bugs:*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment