• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Show Submission Count Today/Month/Year in Module

Show Submission Count Today/Month/Year in Module 11 years 1 day ago #27469

Hi,

is there an easy way to show the Submission Count from the Backend in a Module Position in Frontend? In best case the Submissions from the Logged-in User only.

Best Dominic
The administrator has disabled public write access.

Show Submission Count Today/Month/Year in Module 10 years 11 months ago #27507

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
$db = JFactory::getDbo();
$db->setQuery("SELECT COUNT(`SubmissionId`) FROM #__rsform_submissions WHERE FormId = insert_id_here AND UserId != 0");
$submissions = $db->loadResult();
$formLayout = '<div id="counter">Submissions:'.$submissions.'</div>';


This script creates a counter that will show the current submissions of a specific form, made only by registered users.

For this you will need to create a new empty form. Insert the code in the "Script called on form display" text area (Properties > PHP Scripts). Don't forget to replace "insert_id_here" with the form's id.

Head over to Module Manager > New > RSForm! Pro Module > Select the form you just created and position it as needed.
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.
The following user(s) said Thank You: dominic.weiss

Show Submission Count Today/Month/Year in Module 10 years 10 months ago #27970

The above code works perfect to show the total number of submissions, as the database also stores the date of the submission would is anyone able to help with the extra coding that would be needed to break the information down more as was asked?
Be great to be able to show the data for current month, week, day, year etc.

guessing it will be something like:
$db = JFactory::getDbo();
$db->setQuery("SELECT COUNT(`SubmissionId`) FROM #__rsform_submissions WHERE FormId = insert_id_here AND DateSubmitted = code_for_current_month AND UserId != 0");
$submissions = $db->loadResult();
$formLayout = '<div id="counter">Submissions:'.$submissions.'</div>';
The administrator has disabled public write access.

Show Submission Count Today/Month/Year in Module 10 years 10 months ago #27971

I have had a play and the following works for me, it allows the module to show the number of submissions by month and year total.
$db = JFactory::getDbo();
$current_date = date("Y-m-d");
$db->setQuery("SELECT COUNT(`SubmissionId`) FROM #__rsform_submissions WHERE FormId = your_form_ID AND MONTH(DateSubmitted) = MONTH ('$current_date') ");
$submissions = $db->loadResult();
$db->setQuery("SELECT COUNT(`SubmissionId`) FROM #__rsform_submissions WHERE FormId = your_form_ID AND YEAR(DateSubmitted) = YEAR ('$current_date') ");
$submissions2 = $db->loadResult();
$formLayout = '<div id="counter">Current Month:'.$submissions.'</br>Current Year:'.$submissions2.'</div> ';

Not sure is there is a cleaner way to do this? if there is I would love to know.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!