How to show number of people that have filled out a registration form using forminator plugin in Wordpress?

Viewed 470

I am using the Forminator plugin in Wordpress to create a section of "challenges" that users can sign up for . In order to sign up to this challenges the users are asked to fill out a registration form that requests some personal information.

My goal now is to be able to show how many people have signed up for the challenge on the website, so essentially a counter that shows how many people have filled out the form, as if it were the amount of people attending an event. Is there any way to do this? I am using Wordpress with the Elementor page editor, and the Forminator plugin for the forms.

challenge page screenshot

1 Answers

You can display the number of registered users by adding the code to your functions.php file

// Function to return user count
function custom_user_count() { 
$usercount = count_users();
$result = $usercount['total_users']; 
return $result; 
} 
// Creating a shortcode to display user count
add_shortcode('user_count', 'custom_user_count');

And then add the following shortcode to your Elementor block:

[user_count]

To get the users count only for Forminator plugin, please, use:

function get_all_submission_count() {
    ob_start();
    global $wpdb;
    $table_name = $wpdb->prefix . 'frmt_form_entry';
    $count_query = "select count(*) from $table_name";
    $count = $wpdb->get_var($count_query);
    return $count;
}

UPD

To get the Submissions without any registration / database issues, please, use the following snippet:

According to this info:

https://wpmudev.com/forums/topic/show-forminator-form-submission-count-in-the-front-end/

You can download the snippet from here: https://gist.github.com/wpmudev-sls/f0f3068ae2647cba05911a5374b38447

Once downloaded, you can unzip it and upload the wpmudev-forminator-shortcode-show-submissions.php file to your site’s wp-content/mu-plugins directory.

Related