To automatically save entries from an Elementor form and sort them per day in the WordPress backend, you can follow these steps:
Install and activate the “Elementor Pro” plugin (if you haven’t already). This plugin provides advanced form functionality.
Create a new form using Elementor Pro:
- In your WordPress admin area, go to “Templates” and click on “Add New.”
- Select the “Elementor Canvas” template and give it a title.
- Click on the “Edit with Elementor” button to start building the form.
Add form fields to your Elementor form:
- Drag and drop the form fields you want to include from the left-hand Elementor panel onto the canvas.
- Customize the form fields as per your requirements (e.g., labels, placeholder text, validation rules).
Set up form actions:
- After designing your form, click on the form widget and go to the “Actions After Submit” section.
- Enable the “Save to Database” option. This will ensure that form submissions are saved in the WordPress database.
Install and activate the “WPForms” plugin:
- WPForms is a powerful form builder plugin for WordPress that offers enhanced features for form submissions.
Create a new WPForms entry view:
- In your WordPress admin area, go to “WPForms” and click on “Entries.”
- Click on the “Add New” button to create a new entry view.
- Give your entry view a title and select the form you created with Elementor.
Customize the entry view settings:
- In the entry view settings, you can choose the columns you want to display, including the date field.
- Set the sorting order to “Descending” based on the date field, so the latest entries appear at the top.
Save the entry view and check the results:
- Save your entry view and navigate to the “WPForms” > “Entries” section.
- You should see a list of form submissions sorted by the date, with the latest entries at the top.
By following these steps, you’ll be able to automatically save entries from an Elementor form and sort them per day in the WordPress backend. Remember, this approach combines the functionalities of Elementor Pro and WPForms to achieve the desired result.
To add a feature that sends you an email if the form is not sent each day, you can follow these additional steps:
Install and activate the “WP Mail SMTP” plugin:
- This plugin allows you to configure your WordPress site to use an SMTP service for sending emails reliably.
Set up an email account to send notifications:
- Create an email account specifically for sending notifications regarding the form submissions.
- Note down the SMTP settings (server address, port, username, password) of your email account.
Configure WP Mail SMTP plugin settings:
- In your WordPress admin area, go to “WP Mail SMTP” and click on “Settings.”
- Configure the plugin settings to use the SMTP details of your email account.
Create a custom WordPress function:
- In your WordPress theme’s functions.php file or using a custom plugin, create a custom function that checks if the form has been submitted each day.
- You can use the
wp_mail()
function to send an email if the form has not been submitted.
Here’s an example of how the custom function could be written:
function check_form_submission_daily() {
// Check if it's a new day (based on server time)
$last_submission_date = get_option('form_last_submission_date'); // Retrieve the last submission date from WordPress options
$current_date = date('Y-m-d'); // Get the current date
if ($current_date !== $last_submission_date) {
// Send email notification
$email_to = 'your-email@example.com'; // Replace with your email address
$email_subject = 'Form Submission Not Received Today';
$email_message = 'Please check the form as no submissions were received today.';
wp_mail($email_to, $email_subject, $email_message);
// Update the last submission date
update_option('form_last_submission_date', $current_date);
}
}
- Schedule the custom function to run daily:
- To ensure the function runs automatically every day, you can use WordPress’s cron functionality.
- Add the following code to your theme’s functions.php file or a custom plugin:
// Schedule the function to run once daily
add_action('init', 'schedule_form_submission_check');
function schedule_form_submission_check() {
if (!wp_next_scheduled('check_form_submission_daily')) {
wp_schedule_event(strtotime('00:00:00'), 'daily', 'check_form_submission_daily');
}
}
With these steps, the custom function will run once daily and check if the form has been submitted. If no submission is detected, it will send you an email notification. The last submission date will be stored in WordPress options to compare it with the current date on subsequent runs.
Please note that modifying code in your WordPress theme or using a custom plugin requires some technical knowledge. It’s always recommended to perform these customizations on a staging or development site first to ensure compatibility and avoid any potential issues on your live site.
Yes, the approach described can work with multiple forms. You can modify the code to handle multiple forms and track their submissions individually. Here’s an updated version of the custom function that supports multiple forms:
function check_form_submission_daily() {
$forms = array(
'form_id_1' => 'Form 1', // Replace 'form_id_1' with the actual form ID, and 'Form 1' with a descriptive name
'form_id_2' => 'Form 2', // Add more entries for additional forms
// Add more entries for additional forms
);
foreach ($forms as $form_id => $form_name) {
// Check if it's a new day (based on server time)
$last_submission_date = get_option('form_last_submission_date_' . $form_id); // Retrieve the last submission date for the current form
$current_date = date('Y-m-d'); // Get the current date
if ($current_date !== $last_submission_date) {
// Send email notification
$email_to = 'your-email@example.com'; // Replace with your email address
$email_subject = 'Form Submission Not Received Today';
$email_message = 'Form: ' . $form_name . "\n";
$email_message .= 'Please check the form as no submissions were received today.';
wp_mail($email_to, $email_subject, $email_message);
// Update the last submission date for the current form
update_option('form_last_submission_date_' . $form_id, $current_date);
}
}
}
In this updated version, the $forms
array contains the form IDs and their corresponding names. You can add more entries to this array for additional forms.
The code then iterates through each form, checks if the current date differs from the last submission date for that form, and sends an email notification if no submission is detected. The last submission date for each form is stored separately in WordPress options based on the form ID.
By using this updated code, you can monitor multiple forms and receive email notifications if any of them are not submitted on a given day.