Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/ninja-fo.../deprecat.../includes
File: deprecated.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Deprecated as of version 2.7.
[3] Fix | Delete
*/
[4] Fix | Delete
[5] Fix | Delete
// Hook into our new save sub filter to add any deprecated filters
[6] Fix | Delete
function nf_old_save_sub_filter( $user_value, $field_id ) {
[7] Fix | Delete
return apply_filters( 'ninja_forms_save_sub', $user_value, $field_id );
[8] Fix | Delete
}
[9] Fix | Delete
[10] Fix | Delete
add_filter( 'nf_save_sub_user_value', 'nf_old_save_sub_filter', 10, 2 );
[11] Fix | Delete
[12] Fix | Delete
// Hook into our new nf_save_sub action and add any actions hooked into our old action hooks.
[13] Fix | Delete
function nf_old_save_sub_action( $sub_id ) {
[14] Fix | Delete
do_action( 'ninja_forms_insert_sub', $sub_id );
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
add_action( 'nf_save_sub', 'nf_old_save_sub_action' );
[18] Fix | Delete
[19] Fix | Delete
// Hook into our new submissions CSV filename filter.
[20] Fix | Delete
function nf_old_subs_csv_filename( $filename ) {
[21] Fix | Delete
return apply_filters( 'ninja_forms_export_subs_csv_file_name', $filename );
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
add_filter( 'nf_subs_csv_filename', 'nf_old_subs_csv_filename' );
[25] Fix | Delete
[26] Fix | Delete
// Hook into our new submissions CSV label filter.
[27] Fix | Delete
function nf_old_subs_csv_label( $label, $field_id ) {
[28] Fix | Delete
return apply_filters( 'ninja_forms_export_sub_label', $label, $field_id );
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
add_filter( 'nf_subs_csv_field_label', 'nf_old_subs_csv_label', 10, 2 );
[32] Fix | Delete
[33] Fix | Delete
// Hook into our new submissions CSV label array filter.
[34] Fix | Delete
function nf_old_subs_csv_label_array( $label_array, $sub_ids ) {
[35] Fix | Delete
return apply_filters( 'ninja_forms_export_subs_label_array', $label_array, $sub_ids );
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
add_filter( 'nf_subs_csv_label_array', 'nf_old_subs_csv_label_array', 10, 2 );
[39] Fix | Delete
[40] Fix | Delete
// Hook into our new submissions CSV pre_value filter.
[41] Fix | Delete
function nf_old_subs_csv_pre_value( $user_value, $field_id ) {
[42] Fix | Delete
return apply_filters( 'ninja_forms_export_sub_pre_value', $user_value, $field_id );
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
add_filter( 'nf_subs_export_pre_value', 'nf_old_subs_csv_pre_value', 10, 2 );
[46] Fix | Delete
[47] Fix | Delete
// Hook into our new submissions CSV value filter.
[48] Fix | Delete
function nf_old_subs_csv_value( $user_value, $field_id ) {
[49] Fix | Delete
return apply_filters( 'ninja_forms_export_sub_value', $user_value, $field_id );
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
add_filter( 'nf_subs_csv_field_value', 'nf_old_subs_csv_value', 10, 2 );
[53] Fix | Delete
[54] Fix | Delete
// Hook into our new submissions CSV value array filter.
[55] Fix | Delete
function nf_old_subs_csv_value_array( $values_array, $sub_ids ) {
[56] Fix | Delete
return apply_filters( 'ninja_forms_export_subs_value_array', $values_array, $sub_ids );
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
add_filter( 'nf_subs_csv_value_array', 'nf_old_subs_csv_value_array', 10, 2 );
[60] Fix | Delete
[61] Fix | Delete
// Hook into our new CSV BOM filter
[62] Fix | Delete
function nf_old_subs_csv_bom( $bom ) {
[63] Fix | Delete
return apply_filters( 'ninja_forms_csv_bom', $bom );
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
add_filter( 'nf_sub_csv_bom', 'nf_old_subs_csv_bom' );
[67] Fix | Delete
[68] Fix | Delete
// Hook into our new CSV delimiter filter
[69] Fix | Delete
function nf_old_subs_csv_delimiter( $delimiter ) {
[70] Fix | Delete
return apply_filters( 'ninja_forms_csv_delimiter', $delimiter );
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
add_filter( 'nf_sub_csv_delimiter', 'nf_old_subs_csv_delimiter' );
[74] Fix | Delete
[75] Fix | Delete
// Hook into our new CSV enclosure filter
[76] Fix | Delete
function nf_old_subs_csv_enclosure( $enclosure ) {
[77] Fix | Delete
return apply_filters( 'ninja_forms_csv_enclosure', $enclosure );
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
add_filter( 'nf_sub_csv_enclosure', 'nf_old_subs_csv_enclosure' );
[81] Fix | Delete
[82] Fix | Delete
// Hook into our new CSV terminator filter
[83] Fix | Delete
function nf_old_subs_csv_terminator( $terminator ) {
[84] Fix | Delete
return apply_filters( 'ninja_forms_csv_terminator', $terminator );
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
add_filter( 'nf_sub_csv_terminator', 'nf_old_subs_csv_terminator' );
[88] Fix | Delete
[89] Fix | Delete
// Hook into our new Submissions table row-actions filter
[90] Fix | Delete
function nf_old_subs_table_row_actions_filter( $actions, $sub_id, $form_id ) {
[91] Fix | Delete
return apply_filters( 'ninja_forms_sub_table_row_actions', array(), false, $sub_id, $form_id );
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
add_filter( 'nf_sub_table_row_actions', 'nf_old_subs_table_row_actions_filter', 10, 3 );
[95] Fix | Delete
[96] Fix | Delete
/**
[97] Fix | Delete
* ninja_forms_get_subs() has been deprecated in favour of Ninja_Forms()->subs()->get( $args ) or Ninja_Forms()->form( 23 )->get_subs( $args )
[98] Fix | Delete
* You can also use WordPress queries ,since this is a custom post type.
[99] Fix | Delete
*
[100] Fix | Delete
* @since 2.7
[101] Fix | Delete
*/
[102] Fix | Delete
[103] Fix | Delete
function ninja_forms_get_subs( $args = array() ) {
[104] Fix | Delete
[105] Fix | Delete
$plugin_settings = nf_get_settings();
[106] Fix | Delete
[107] Fix | Delete
if ( isset ( $plugin_settings['date_format'] ) ) {
[108] Fix | Delete
$date_format = $plugin_settings['date_format'];
[109] Fix | Delete
} else {
[110] Fix | Delete
$date_format = 'm/d/Y';
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
if( is_array( $args ) AND ! empty( $args ) ) {
[114] Fix | Delete
[115] Fix | Delete
$subs_results = array();
[116] Fix | Delete
$meta_query = array();
[117] Fix | Delete
$date_query = array();
[118] Fix | Delete
[119] Fix | Delete
if( isset( $args['form_id'] ) ) {
[120] Fix | Delete
$meta_query[] = array(
[121] Fix | Delete
'key' => '_form_id',
[122] Fix | Delete
'value' => $args['form_id'],
[123] Fix | Delete
);
[124] Fix | Delete
}
[125] Fix | Delete
[126] Fix | Delete
if( isset( $args['action'])){
[127] Fix | Delete
$meta_query[] = array(
[128] Fix | Delete
'key' => '_action',
[129] Fix | Delete
'value' => $args['action'],
[130] Fix | Delete
);
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
$query_args = array(
[134] Fix | Delete
'post_type' => 'nf_sub',
[135] Fix | Delete
'date_query' => $date_query,
[136] Fix | Delete
'meta_query' => $meta_query,
[137] Fix | Delete
'posts_per_page' => -1,
[138] Fix | Delete
);
[139] Fix | Delete
[140] Fix | Delete
if( isset( $args['user_id'] ) ) {
[141] Fix | Delete
$query_args['author'] = $args['user_id'];
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
[145] Fix | Delete
[146] Fix | Delete
if( isset( $args['begin_date'] ) AND $args['begin_date'] != '') {
[147] Fix | Delete
$query_args['date_query']['after'] = nf_get_begin_date( $args['begin_date'] )->format("Y-m-d G:i:s");
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
if( isset( $args['end_date'] ) AND $args['end_date'] != '' ) {
[151] Fix | Delete
$query_args['date_query']['before'] = nf_get_end_date( $args['end_date'] )->format("Y-m-d G:i:s");
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
$subs = get_posts( $query_args );
[155] Fix | Delete
[156] Fix | Delete
if ( is_array( $subs ) && ! empty( $subs ) ) {
[157] Fix | Delete
$x = 0;
[158] Fix | Delete
foreach ( $subs as $sub ) {
[159] Fix | Delete
$data = array();
[160] Fix | Delete
$subs_results[$x]['id'] = $sub->ID;
[161] Fix | Delete
$subs_results[$x]['user_id'] = $sub->post_author;
[162] Fix | Delete
$subs_results[$x]['form_id'] = get_post_meta( $sub->ID, '_form_id' );
[163] Fix | Delete
$subs_results[$x]['action'] = get_post_meta( $sub->ID, '_action' );
[164] Fix | Delete
[165] Fix | Delete
$meta = get_post_custom( $sub->ID );
[166] Fix | Delete
[167] Fix | Delete
foreach ( $meta as $key => $array ) {
[168] Fix | Delete
if ( strpos( $key, '_field_' ) !== false ) {
[169] Fix | Delete
$field_id = str_replace( '_field_', '', $key );
[170] Fix | Delete
$user_value = $array[0];
[171] Fix | Delete
$data[] = array( 'field_id' => $field_id, 'user_value' => $user_value );
[172] Fix | Delete
}
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
$subs_results[$x]['data'] = $data;
[176] Fix | Delete
$subs_results[$x]['date_updated'] = $sub->post_modified;
[177] Fix | Delete
[178] Fix | Delete
$x++;
[179] Fix | Delete
}
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
return $subs_results;
[183] Fix | Delete
}
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
/**
[187] Fix | Delete
* ninja_forms_get_sub_count() has been deprecated in favour of Ninja_Forms()->form( 23 )->sub_count or nf_get_sub_count()
[188] Fix | Delete
* Function that returns a count of the number of submissions.
[189] Fix | Delete
*
[190] Fix | Delete
* @since 2.7
[191] Fix | Delete
*/
[192] Fix | Delete
[193] Fix | Delete
function ninja_forms_get_sub_count( $args = array() ) {
[194] Fix | Delete
return count( ninja_forms_get_subs( $args ) );
[195] Fix | Delete
}
[196] Fix | Delete
[197] Fix | Delete
/**
[198] Fix | Delete
* ninja_forms_get_sub_by_id( $sub_id ) has been deprecated in favour of Ninja_Forms()->sub( 23 );
[199] Fix | Delete
*
[200] Fix | Delete
* @since 2.7
[201] Fix | Delete
*/
[202] Fix | Delete
[203] Fix | Delete
function ninja_forms_get_sub_by_id( $sub_id ) {
[204] Fix | Delete
$sub = Ninja_Forms()->sub( $sub_id );
[205] Fix | Delete
if ( $sub ) {
[206] Fix | Delete
$sub_row = array();
[207] Fix | Delete
$data = array();
[208] Fix | Delete
$sub_row['id'] = $sub_id;
[209] Fix | Delete
$sub_row['user_id'] = $sub->user_id;
[210] Fix | Delete
$sub_row['form_id'] = $sub->form_id;
[211] Fix | Delete
$sub_row['action'] = $sub->action;
[212] Fix | Delete
[213] Fix | Delete
if ( $sub->action == 'submit' ) {
[214] Fix | Delete
$sub_row['status'] = 1;
[215] Fix | Delete
} else {
[216] Fix | Delete
$sub_row['status'] = 0;
[217] Fix | Delete
}
[218] Fix | Delete
[219] Fix | Delete
$meta = get_post_custom( $sub_id );
[220] Fix | Delete
[221] Fix | Delete
foreach ( $meta as $key => $array ) {
[222] Fix | Delete
if ( strpos( $key, '_field_' ) !== false ) {
[223] Fix | Delete
$field_id = str_replace( '_field_', '', $key );
[224] Fix | Delete
$user_value = is_serialized( $array[0] ) ? unserialize( $array[0] ) : $array[0];
[225] Fix | Delete
$data[] = array( 'field_id' => $field_id, 'user_value' => $user_value );
[226] Fix | Delete
}
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
$sub_row['data'] = $data;
[230] Fix | Delete
$sub_row['date_updated'] = $sub->date_submitted;
[231] Fix | Delete
[232] Fix | Delete
return $sub_row;
[233] Fix | Delete
} else {
[234] Fix | Delete
return false;
[235] Fix | Delete
}
[236] Fix | Delete
}
[237] Fix | Delete
[238] Fix | Delete
/**
[239] Fix | Delete
* ninja_forms_get_all_subs() has been deprecated in favour of Ninja_Forms()->subs()->get();
[240] Fix | Delete
*
[241] Fix | Delete
* @since 2.7
[242] Fix | Delete
*/
[243] Fix | Delete
[244] Fix | Delete
function ninja_forms_get_all_subs( $form_id = '' ){
[245] Fix | Delete
if ( $form_id == '' )
[246] Fix | Delete
return false;
[247] Fix | Delete
[248] Fix | Delete
$args = array( 'form_id' => $form_id );
[249] Fix | Delete
return ninja_forms_get_subs( $args );
[250] Fix | Delete
}
[251] Fix | Delete
[252] Fix | Delete
/**
[253] Fix | Delete
* ninja_forms_insert_sub() has been deprecated in favour of Ninja_Forms()->subs()->create( $form_id );
[254] Fix | Delete
* Because submissions are now a CPT, this function will only return false.
[255] Fix | Delete
* Please replace any instances of this function with the replacement.
[256] Fix | Delete
*
[257] Fix | Delete
* @since 2.7
[258] Fix | Delete
*/
[259] Fix | Delete
[260] Fix | Delete
function ninja_forms_insert_sub( $args ) {
[261] Fix | Delete
[262] Fix | Delete
if ( ! isset ( $args['form_id'] ) )
[263] Fix | Delete
return false;
[264] Fix | Delete
[265] Fix | Delete
$form_id = $args['form_id'];
[266] Fix | Delete
[267] Fix | Delete
$sub_id = Ninja_Forms()->subs()->create( $form_id );
[268] Fix | Delete
$args['sub_id'] = $sub_id;
[269] Fix | Delete
[270] Fix | Delete
ninja_forms_update_sub( $args );
[271] Fix | Delete
[272] Fix | Delete
return $sub_id;
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
/**
[276] Fix | Delete
* ninja_forms_update_sub() has been deprecated in favour of Ninja_Forms()->sub( 23 )->update_field( id, value );
[277] Fix | Delete
* Because submissions are now a CPT, this function will only return false.
[278] Fix | Delete
* Please replace any instances of this function with the replacement.
[279] Fix | Delete
*
[280] Fix | Delete
* @since 2.7
[281] Fix | Delete
*/
[282] Fix | Delete
[283] Fix | Delete
function ninja_forms_update_sub( $args ){
[284] Fix | Delete
if ( ! isset ( $args['sub_id'] ) )
[285] Fix | Delete
return false;
[286] Fix | Delete
[287] Fix | Delete
$sub_id = $args['sub_id'];
[288] Fix | Delete
$sub = Ninja_Forms()->sub( $sub_id );
[289] Fix | Delete
[290] Fix | Delete
if ( isset ( $args['data'] ) ) {
[291] Fix | Delete
$data = $args['data'];
[292] Fix | Delete
unset ( $args['data'] );
[293] Fix | Delete
[294] Fix | Delete
if ( is_serialized( $data ) ) {
[295] Fix | Delete
$data = unserialize( $data );
[296] Fix | Delete
[297] Fix | Delete
foreach ( $data as $d ) {
[298] Fix | Delete
$field_id = $d['field_id'];
[299] Fix | Delete
$user_value = $d['user_value'];
[300] Fix | Delete
$sub->add_field( $field_id, $user_value );
[301] Fix | Delete
}
[302] Fix | Delete
}
[303] Fix | Delete
}
[304] Fix | Delete
[305] Fix | Delete
foreach ( $args as $key => $value ) {
[306] Fix | Delete
$sub->update_meta( '_' . $key, $value );
[307] Fix | Delete
}
[308] Fix | Delete
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
/**
[312] Fix | Delete
* ninja_forms_export_subs_to_csv() has been deprecated in favour of Ninja_Forms()->subs()->export( sub_ids, return );
[313] Fix | Delete
* or Ninja_Forms()->sub( 23 )->export( return );
[314] Fix | Delete
* Please replace any instances of this function with the replacement.
[315] Fix | Delete
*
[316] Fix | Delete
* @since 2.7
[317] Fix | Delete
*/
[318] Fix | Delete
[319] Fix | Delete
function ninja_forms_export_subs_to_csv( $sub_ids = '', $return = false ){
[320] Fix | Delete
Ninja_Forms()->subs()->export( $sub_ids, $return );
[321] Fix | Delete
}
[322] Fix | Delete
[323] Fix | Delete
function ninja_forms_implode_r($glue, $pieces){
[324] Fix | Delete
$out = '';
[325] Fix | Delete
foreach ( $pieces as $piece ) {
[326] Fix | Delete
if ( is_array ( $piece ) ) {
[327] Fix | Delete
if ( $out == '' ) {
[328] Fix | Delete
$out = ninja_forms_implode_r($glue, $piece);
[329] Fix | Delete
} else {
[330] Fix | Delete
$out .= ninja_forms_implode_r($glue, $piece); // recurse
[331] Fix | Delete
}
[332] Fix | Delete
} else {
[333] Fix | Delete
if ( $out == '' ) {
[334] Fix | Delete
$out .= $piece;
[335] Fix | Delete
} else {
[336] Fix | Delete
$out .= $glue.$piece;
[337] Fix | Delete
}
[338] Fix | Delete
}
[339] Fix | Delete
}
[340] Fix | Delete
return $out;
[341] Fix | Delete
}
[342] Fix | Delete
[343] Fix | Delete
[344] Fix | Delete
/**
[345] Fix | Delete
* Get the csv delimiter
[346] Fix | Delete
*
[347] Fix | Delete
* @return string
[348] Fix | Delete
*/
[349] Fix | Delete
function ninja_forms_get_csv_delimiter() {
[350] Fix | Delete
return apply_filters( 'ninja_forms_csv_delimiter', ',' );
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
/**
[354] Fix | Delete
* Get the csv enclosure
[355] Fix | Delete
*
[356] Fix | Delete
* @return string
[357] Fix | Delete
*/
[358] Fix | Delete
function ninja_forms_get_csv_enclosure() {
[359] Fix | Delete
return apply_filters( 'ninja_forms_csv_enclosure', '"' );
[360] Fix | Delete
}
[361] Fix | Delete
[362] Fix | Delete
/**
[363] Fix | Delete
* Get the csv delimiter
[364] Fix | Delete
*
[365] Fix | Delete
* @return string
[366] Fix | Delete
*/
[367] Fix | Delete
function ninja_forms_get_csv_terminator() {
[368] Fix | Delete
return apply_filters( 'ninja_forms_csv_terminator', "\n" );
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
/**
[372] Fix | Delete
* Wrapper for nf_save_sub()
[373] Fix | Delete
*/
[374] Fix | Delete
function ninja_forms_save_sub() {
[375] Fix | Delete
nf_save_sub();
[376] Fix | Delete
}
[377] Fix | Delete
[378] Fix | Delete
function nf_change_all_forms_filter( $cap ) {
[379] Fix | Delete
return apply_filters( 'ninja_forms_admin_menu_capabilities', $cap );
[380] Fix | Delete
}
[381] Fix | Delete
[382] Fix | Delete
add_filter( 'ninja_forms_admin_all_forms_capabilities', 'nf_change_all_forms_filter' );
[383] Fix | Delete
[384] Fix | Delete
function nf_change_admin_menu_filter( $cap ) {
[385] Fix | Delete
return apply_filters( 'ninja_forms_admin_menu_capabilities', $cap );
[386] Fix | Delete
}
[387] Fix | Delete
[388] Fix | Delete
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'nf_change_admin_menu_filter' );
[389] Fix | Delete
[390] Fix | Delete
/**
[391] Fix | Delete
* Deprecated as of version 2.8
[392] Fix | Delete
*/
[393] Fix | Delete
[394] Fix | Delete
// The admin_mailto setting has been deprecated. Because users may have used this setting to modify who receives the admin email,
[395] Fix | Delete
// we need to make sure that it is backwards compatible.
[396] Fix | Delete
function nf_clear_admin_mailto() {
[397] Fix | Delete
global $ninja_forms_processing;
[398] Fix | Delete
[399] Fix | Delete
$ninja_forms_processing->update_form_setting( 'admin_mailto', array() );
[400] Fix | Delete
}
[401] Fix | Delete
[402] Fix | Delete
add_action( 'ninja_forms_before_pre_process', 'nf_clear_admin_mailto' );
[403] Fix | Delete
[404] Fix | Delete
function nf_modify_admin_mailto( $setting, $setting_name, $id ) {
[405] Fix | Delete
global $ninja_forms_processing;
[406] Fix | Delete
[407] Fix | Delete
// Bail if this isn't our admin notification
[408] Fix | Delete
if ( ! nf_get_object_meta_value( $id, 'admin_email' ) )
[409] Fix | Delete
return $setting;
[410] Fix | Delete
[411] Fix | Delete
// Bail if this isn't the "to" setting.
[412] Fix | Delete
if ( $setting_name != 'to' )
[413] Fix | Delete
return $setting;
[414] Fix | Delete
[415] Fix | Delete
$admin_mailto = $ninja_forms_processing->get_form_setting( 'admin_mailto' );
[416] Fix | Delete
$ninja_forms_processing->update_form_setting( 'admin_mailto', '' );
[417] Fix | Delete
[418] Fix | Delete
if ( is_array( $admin_mailto ) && ! empty ( $admin_mailto ) ) {
[419] Fix | Delete
$setting = array_merge( $setting, $admin_mailto );
[420] Fix | Delete
}
[421] Fix | Delete
[422] Fix | Delete
return $setting;
[423] Fix | Delete
}
[424] Fix | Delete
[425] Fix | Delete
add_filter( 'nf_email_notification_process_setting','nf_modify_admin_mailto', 10, 3 );
[426] Fix | Delete
[427] Fix | Delete
add_action('init', 'ninja_forms_register_filter_email_add_fields', 15 );
[428] Fix | Delete
function ninja_forms_register_filter_email_add_fields(){
[429] Fix | Delete
global $ninja_forms_processing;
[430] Fix | Delete
[431] Fix | Delete
if( is_object( $ninja_forms_processing ) ){
[432] Fix | Delete
if( $ninja_forms_processing->get_form_setting( 'user_email_fields' ) == 1 ){
[433] Fix | Delete
add_filter( 'ninja_forms_user_email', 'ninja_forms_filter_email_add_fields' );
[434] Fix | Delete
}
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
if( is_object( $ninja_forms_processing ) ){
[438] Fix | Delete
if( $ninja_forms_processing->get_form_setting( 'admin_email_fields' ) == 1 ){
[439] Fix | Delete
add_filter( 'ninja_forms_admin_email', 'ninja_forms_filter_email_add_fields' );
[440] Fix | Delete
}
[441] Fix | Delete
}
[442] Fix | Delete
}
[443] Fix | Delete
[444] Fix | Delete
function ninja_forms_filter_email_add_fields( $message ){
[445] Fix | Delete
global $ninja_forms_processing, $ninja_forms_fields;
[446] Fix | Delete
[447] Fix | Delete
$form_id = $ninja_forms_processing->get_form_ID();
[448] Fix | Delete
$all_fields = ninja_forms_get_fields_by_form_id( $form_id );
[449] Fix | Delete
//$all_fields = $ninja_forms_processing->get_all_fields();
[450] Fix | Delete
$tmp_array = array();
[451] Fix | Delete
if( is_array( $all_fields ) ){
[452] Fix | Delete
foreach( $all_fields as $field ){
[453] Fix | Delete
if( $ninja_forms_processing->get_field_value( $field['id'] ) ){
[454] Fix | Delete
$tmp_array[$field['id']] = $ninja_forms_processing->get_field_value( $field['id'] );
[455] Fix | Delete
}
[456] Fix | Delete
}
[457] Fix | Delete
}
[458] Fix | Delete
$all_fields = apply_filters( 'ninja_forms_email_all_fields_array', $tmp_array, $form_id );
[459] Fix | Delete
[460] Fix | Delete
$email_type = $ninja_forms_processing->get_form_setting( 'email_type' );
[461] Fix | Delete
if(is_array($all_fields) AND !empty($all_fields)){
[462] Fix | Delete
if($email_type == 'html'){
[463] Fix | Delete
$message .= "<br><br>";
[464] Fix | Delete
$message .= apply_filters( 'nf_email_user_values_title', __( 'User Submitted Values:', 'ninja-forms' ) );
[465] Fix | Delete
$message .= "<table>";
[466] Fix | Delete
}else{
[467] Fix | Delete
$message = str_replace("<p>", "\r\n", $message);
[468] Fix | Delete
$message = str_replace("</p>", "", $message);
[469] Fix | Delete
$message = str_replace("<br>", "\r\n", $message);
[470] Fix | Delete
$message = str_replace("<br />", "\r\n", $message);
[471] Fix | Delete
$message = strip_tags($message);
[472] Fix | Delete
$message .= "\r\n \r\n";
[473] Fix | Delete
$message .= apply_filters( 'nf_email_user_values_title', __( 'User Submitted Values:', 'ninja-forms' ) );
[474] Fix | Delete
$message .= "\r\n";
[475] Fix | Delete
}
[476] Fix | Delete
foreach( $all_fields as $field_id => $user_value ){
[477] Fix | Delete
[478] Fix | Delete
$field_row = $ninja_forms_processing->get_field_settings( $field_id );
[479] Fix | Delete
$field_label = $field_row['data']['label'];
[480] Fix | Delete
$field_label = apply_filters( 'ninja_forms_email_field_label', $field_label, $field_id );
[481] Fix | Delete
$user_value = apply_filters( 'ninja_forms_email_user_value', $user_value, $field_id );
[482] Fix | Delete
$field_type = $field_row['type'];
[483] Fix | Delete
[484] Fix | Delete
if( $ninja_forms_fields[$field_type]['process_field'] ){
[485] Fix | Delete
if( is_array( $user_value ) AND !empty( $user_value ) ){
[486] Fix | Delete
$x = 0;
[487] Fix | Delete
foreach($user_value as $val){
[488] Fix | Delete
if(!is_array($val)){
[489] Fix | Delete
if($x > 0){
[490] Fix | Delete
$field_label = '----';
[491] Fix | Delete
$field_label = apply_filters( 'ninja_forms_email_field_label', $field_label, $field_id );
[492] Fix | Delete
}
[493] Fix | Delete
if($email_type == 'html'){
[494] Fix | Delete
$message .= "<tr><td width='50%'>".$field_label.":</td><td width='50%'>".$val."</td></tr>";
[495] Fix | Delete
}else{
[496] Fix | Delete
$message .= $field_label." - ".$val."\r\n";
[497] Fix | Delete
}
[498] Fix | Delete
}else{
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function