Home › Toolset Professional Support › [Resolved] Forms do not send email to post author
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | - | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 |
- | - | - | - | - | - | - |
Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)
Tagged: Content-submission forms, Toolset Forms
Related documentation:
This topic contains 73 replies, has 6 voices.
Last updated by Beda 5 years, 7 months ago.
Assisted by: Beda.
I am trying to: have some forms send an email to the post author when the form is submitted
Link to a page where the issue can be seen: hidden link
From testing, this appears to be a conflict with the Avada Child theme I am using (possibly custom functions added to the child?).
Here is the situation:
- CRED forms send fine to specified email addresses
- CRED forms don't send to post author (I have tested both for form submission and change of post status to "Published")
- If I deactivate Avada Child and move to the Twenty Nineteen the email notifications are sent
- If I deactivate Avada Child and move to theAvada parent the email notifications are sent
I have tested deactivating all plugins except Toolset and this does not solve the issue.
Hello. Thank you for contacting the Toolset support.
Well - it looks like you are running the test on live site. We do not recommend to debug the issue on live site. Could you please share test site where I can debug this issue further?
In addition to this, the FTP access details you shared is not working. Please send me working FTP access details.
I have set the next reply to private which means only you and I have access to it.
Unfortunately - the FTP details you shared is still not working at this end. I've also asked to check this FTP access details to one of my colleagues but its not working for him as well.
I want to check your theme's functions.php file to see is there any such code due to that email notification is not working.
I can definitely connect. I have attached screenshots of my filezilla settings.
I have also reproduced the functions file here in the hope this will help.
<?php function theme_enqueue_styles() { wp_enqueue_style( 'avada-parent-stylesheet', get_template_directory_uri() . '/style.css' ); } add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function avada_lang_setup() { $lang = get_stylesheet_directory() . '/languages'; load_child_theme_textdomain( 'Avada', $lang ); } add_action( 'after_setup_theme', 'avada_lang_setup' ); /* Retrieve and return variable named 'role' passed by url */ add_shortcode( 'getrole', 'rvgetfield' ); function rvgetfield( $atts, $content = "" ) { return wp_kses($_GET['role']); } /*Print button */ add_shortcode( 'rvprint','rvprint'); function rvprint($atts, $content=""){ return '<a href="javascript:window.print()" rel="nofollow"> <i class="fa fa-print"></i> Print </a>'; } /* post views counter...works with post views counter plugin */ add_shortcode('rvpostviews', 'rvpostviews'); function rvpostviews ( $atts ) { // prepare defaults $counter = shortcode_atts( array ( 'postid' => 1, ), $atts ); $post=$counter['postid']; $output=pvc_get_post_views( $post_id = $post ); return $output; } /* Retrieve and return variable named 'userid' passed by url */ add_shortcode( 'getuserid', 'rvgetuserfield' ); function rvgetuserfield( $atts, $content = "" ) { return wp_kses($_GET['userid']); } function admin_default_page() { return '/index.php'; } add_filter('login_redirect', 'admin_default_page'); /* Date for today */ add_shortcode('wpv-post-today', 'today_shortcode'); function today_shortcode() { return time(); } /* Date for today minus a year */ add_shortcode('wpv-lastyear', 'lastyear_shortcode'); function lastyear_shortcode() { $d = time(); $yearago= $d-31536000; return $yearago; } /* simple loop counter */ add_shortcode('incrementor', 'incrementor'); function incrementor() { static $i = 1; return $i ++; } /*future or past date calculator*/ add_shortcode( 'advance_date', 'advance_date_shortcode' ); function advance_date_shortcode ( $atts ) { // prepare defaults $advance_date_atts = shortcode_atts( array ( 'date' => time(), // current time as UNIX timestamp 'duration' => 1, // duration in days ), $atts ); $duration_secs = $advance_date_atts['duration'] * 24 * 60 * 60; // days to skip ahead in seconds $advance_date = $advance_date_atts['date'] + $duration_secs; return date( "d M, Y", $advance_date ); } /* Return day name from a date */ add_shortcode( 'wpv_nh_day', 'day_shortcode' ); function day_shortcode($atts) { $a = (shortcode_atts(array( 'dateis' => 0 ), $atts)); return gmdate("l", $a['dateis']); } /* Check day name against today */ function check_day($input) { $timenow = gmdate("l", time()); if (gmdate("l", $input)==$timenow) { return('1'); } else{ return ('0'); } } /* Trim a post element */ add_shortcode('trim', 'trim_shortcode'); function trim_shortcode($atts, $content = '') { $content = wpv_do_shortcode($content); if (strlen($content) > 25) { $content = substr($content, 0, 25) . '…'; } return $content; } /* Return GMT timestamp from local time timestamp (used to correct for BST) */ function stamp_to_gmt( $atts, $content = null ) { $a = shortcode_atts( array( 'local' => '' ), $atts ); $local=$a['local']; //echo 'local input = '.$local; date_default_timezone_set("Europe/London"); $localstring=date('j F Y H:i:s',$local); //echo 'localstring from gmt converter = '.$localstring; $localhour=date('H',$local); //echo 'localhour = '.$localhour; $tz = new DateTimeZone("GMT"); $converted = new DateTime($localstring); $converted->setTimezone($tz); $convertedhour= $converted->format("H"); //echo 'convertedhour = '.$convertedhour; $diff=$convertedhour-$localhour; //echo 'diff'.$diff; //fix for 2300hrs issue - not elegant! if ($diff==23){ $diff=-1;} $localGMT=$local+(60*60*$diff); //echo 'localgmt ='.$localGMT; return $localGMT; } add_shortcode( 'stamp_to_gmt', 'stamp_to_gmt' ); // Return date from epoch time add_shortcode ('rv_epochtodate','rv_epochtodate'); function rv_epochtodate( $atts=array(), $content = null ){ $a = shortcode_atts( array( 'epoch' => '', 'timeformat' => '0' ), $atts ); $epoch=$a['epoch']; $format=$a['timeformat']; if ($format=='1'){ return date('d-m-y H:i:s', $epoch); } if ($format=='0'){ return date('d-m-y', $epoch); } } //group by month and year add_shortcode('heading', 'my_heading'); function my_heading($atts, $content = '') { static $year = null; static $month = null; $condition = $atts['condition']; $value = $atts['value']; switch ($condition) { case 'year': case 'month': if ($$condition != $value) { $$condition = $value; return $content; } break; } return ''; } // Add post expiry date to CRED format add_action('cred_save_data', 'set_expiry_date', 10, 2); function set_expiry_date($post_id, $form_data) { // if a specific form - create show if ($form_data['id']==38851 or $form_data['id']==5606 or $form_data['id']==37157 or $form_data['id']==98325) { if (isset($_POST['expiration-date']['datepicker'])) { // add it to saved post meta update_post_meta($post_id, '_cred_post_expiration_time', $_POST['expiration-date']['datepicker']); } } } // Make Audio Clips delay publishing by three hours to ensure audio is available when published //add_action('cred_save_data', 'set_post_date_to', 100, 3); add_shortcode('rvtest','set_post_date_to'); function set_post_date_to($post_id, $form_data) { //if( $form_data['id'] == 6057 ) { //$publishdate = $_POST ['datetime']; $publishdate= get_the_date('U' ); $newDate = $publishdate+(60*60*3); $newDate = date($newDate,'Y-m-d H:i:s'); $my_post = array( 'ID' => $post_id, 'post_date' => $newDate, 'post_date_gmt' => $newDate, 'post_status' => 'draft' ); return ('ID : '.$mypost['ID'].' orig date : '.$publishdate.' new date : '.$newDate); // Update the post into the database //wp_update_post( $my_post ); //} } // User roles add_shortcode('get_user_role', 'get_user_role_func'); function get_user_role_func($atts, $content){ $atts = shortcode_atts( array( 'user_id' => 0, ), $atts ); $user = new WP_User( $atts['user_id'] ); $arr = array(); if ( !empty( $user->roles ) && is_array( $user->roles ) ) { foreach ( $user->roles as $role ) $arr[] = $role; } $res = implode(', ', $arr); return $res; } // Find out number of related posts /** * Register connections shortcode * * @att (string) relationship : post relationship slug * @return count of connected posts */ add_shortcode( 'connections', function( $atts = [] ){ // provide defaults $atts = shortcode_atts( array( 'relationship' => '', ), $atts ); global $post; $count = 0; $relationship = toolset_get_relationship( $atts['relationship'] ); if ( $relationship ) { $parent = $relationship['roles']['parent']['types'][0]; $child = $relationship['roles']['child']['types'][0]; $type = $post->post_type; $origin = ( $parent == $type ) ? 'parent' : 'child'; // Get connected posts $connections = toolset_get_related_posts( $post->ID, $atts['relationship'], $origin, 9999, 0, array(), 'post_id', 'other', null, 'ASC', true, $count ); } return $count; }); /** * @snippet Simplify Checkout if Only Virtual Products * @how-to Watch tutorial @ <em><u>hidden link</u></em> * @sourcecode <em><u>hidden link</u></em> * @author Rodolfo Melogli * @compatible WooCommerce 3.4.4 */ add_filter( 'woocommerce_checkout_fields' , 'bbloomer_simplify_checkout_virtual' ); function bbloomer_simplify_checkout_virtual( $fields ) { $only_virtual = true; foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { // Check if there are non-virtual products if ( ! $cart_item['data']->is_virtual() ) $only_virtual = false; } if( $only_virtual ) { unset($fields['billing']['billing_company']); unset($fields['billing']['billing_address_1']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_city']); unset($fields['billing']['billing_postcode']); unset($fields['billing']['billing_country']); unset($fields['billing']['billing_state']); unset($fields['billing']['billing_phone']); add_filter( 'woocommerce_enable_order_notes_field', '__return_false' ); } return $fields; } // Fix issue between Toolset and Avada relating to bootstrap control - Source : Toolset support// add_action( 'wp_enqueue_scripts', 'enqueue_bs' ); function enqueue_bs(){ wp_enqueue_style( 'bs-style', '<em><u>hidden link</u></em>' ); } ?>
Ok - thank you. FTP details works now.
I need to check this issue on clean install. I will get back to you as soon as possible.
Well - it seems to work for me on my local test install.
This looks like specific to when using the theme you are using. Could you please send me the link to download theme zip (parent and child) so I can check further whats going wrong there.
I have set the next reply to private which means only you and I have access to it.
Thanks Minesh I will do that as soon as I am able
Per the original ticket I have tested and everything functions fine using the Avada (parent) theme but not the Avada (child) theme. Would this not suggest that something in the child theme's functions.php is causing the problem.?
that is why asked you to share (parent + child ) theme.
But - if you want to try - take a backup of your child theme and try to add brand new child theme without any custom code you added to it's a functions.php file - does that work?
That's a smart idea. I am travelling today and will do that over the weekend so will be in touch then.
Nick
I have attempted with a clean version of the Avada theme child and checked that the functions.php file cotains only the code necessary to inherit. Posting a form still appears not to trigger a notification to the post author (at least for my userid which is that of an administrator). I think however that you may have changed my user's email address so perhaps you received the email?
I do not receive any email yet, I suggest what if you try to change the email address and put your email address and check if that helps?
For me with my test site - the email notification is successfully sent to the loggedin user.
Thanks. OK here is the situation:
- Clean Avada child installed and activated, functions.php contains only the following:
<?php function theme_enqueue_styles() { wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'avada-stylesheet' ) ); } add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function avada_lang_setup() { $lang = get_stylesheet_directory() . '/languages'; load_child_theme_textdomain( 'Avada', $lang ); } add_action( 'after_setup_theme', 'avada_lang_setup' );
NO EMAIL RECEIVED
- Avada parent activated:
EMAIL RECEIVED
The conclusion seems to be that a child Avada theme (the normal way of working with Avada) has some sort of conflict with the notifications. Can you investigate further please?
Thanks
Nick.
I have left the customised Avada child active (it is "Old-Avada-Child-Theme" and the clean version is still installed but not actiove ("Avada-Child-Theme")
Could you please send me the link to download theme zip (parent and child) so I can check further whats going wrong there. OR
Better if you can send me the duplicator package.
=> https://toolset.com/faq/provide-supporters-copy-site/