• 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: Only one submission/user

Only one submission/user 1 year 5 months ago #42319

  • martin83
  • martin83's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
I have a php script on my Joomla 3 that work fine to restrict user to only send one submission, look like this:

global $database;
$rsuser = JFactory::getUser();
$id = $rsuser->get('id');
$database = JFactory::getDBO();
$database->setQuery("SELECT COUNT(`SubmissionId`) FROM dbprefix_rsform_submissions WHERE UserId=$id AND FormId='3'");
$database->query();
if (intval($database->loadResult()) >= 1)
{
echo 'Det är endast tillåtet att ladda upp en bild! Önskar du ladda upp ny bild ska du kontakta This e-mail address is being protected from spambots. You need JavaScript enabled to view it ';
$formLayout = '';
}

In joomla 4 i got this error: 0 Call to undefined method Joomla\Database\Mysqli\MysqliDriver::query()

What do I have to change to get working on Joomla 4?
The administrator has disabled public write access.

Only one submission/user 1 year 5 months ago #42328

  • dragos
  • dragos's Avatar
  • OFFLINE
  • Administrator
  • Posts: 559
  • Thank you received: 102
Hello,

Without custom scripting, you can try using one of the following validation rules while editing the Email field:

- Unique Field: if enabled, this validation will only allow a field value that hasn't been submitted before, for that particular form.
- Unique Field per User: if enabled, this validation will only allow a field value that hasn't been submitted before by the logged in user.

More on this here.

If however you want to take a custom scripting approach, you can find various examples on adding counter for submissions here.
The administrator has disabled public write access.

Only one submission/user 1 year 3 months ago #42488

How about creating an INDEX in the database and applying an UNIQUE property. The database will take care od the rest.
In that index you could simply encapsulate needed fields (columns). For example: USER_ID, RESPONSE_ID this will not allow to save two records with the same use and same response
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!