Hi,
i use chronoforms as a registration event system.
Is it possible to set a limit? (no more entries in the database, e.g. limit of 200 people)
After 200 people it should not be possible to register.
i use chronoforms as a registration event system.
Is it possible to set a limit? (no more entries in the database, e.g. limit of 200 people)
After 200 people it should not be possible to register.
Hi thyl123,
In the On Load event add a Custom Code action with a MySQL query that checks the number of registrations. If its less than 200 show the form, if it's 200 or more then redirect them to a 'We're Full' message.
Bob
In the On Load event add a Custom Code action with a MySQL query that checks the number of registrations. If its less than 200 show the form, if it's 200 or more then redirect them to a 'We're Full' message.
Bob
Ok, i have no experience with mysql,
Can you please post me the query? :-)
Many thanks!
Can you please post me the query? :-)
Many thanks!
Hi thyl123,
Bob
<?php
$db =& JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `#__some_table_name`
WHERE `some_column` = 'some_value' ;
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count > 200 ) {
// redirect the user
}
?>
Bob
Hi Bob,
many thanks for your post!!
Which positions do i have to overwrite now?
many thanks for your post!!
Which positions do i have to overwrite now?
FROM `#tt7xy_chronoforms_data_Spargelturnier_Test`
WHERE `Selector` = '1' ; // I set a new field in the database which have the default value 1 to count it
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count > 200 ) {
// redirect the user //how can i redirect the user? i want a message which says: Registration full like a popup (with OK button) and then a redirection to Home
}
?>
Hi thyl123,
You could also use the Joomla! Redirection code:
Bob
You could also use the Joomla! Redirection code:
. . .
if ( $count > 200 ) {
$mainframe =& JFactory::getApplication();
$mainframe->redirect('index.php', 'Sorry, registration is full');
}
?>
Bob
Sorry to open this thread again.
Does this code also works on a xampp server?
I cloned my homepage and tried to use this limitation, but it doesen't work.
I tried it on my real homepage. It also doesn't work. I have installed the new version of chronoforms V4.
I do not find the mistake. DB table is correct, Selector is set.
Can someone help me?
Does this code also works on a xampp server?
I cloned my homepage and tried to use this limitation, but it doesen't work.
I tried it on my real homepage. It also doesn't work. I have installed the new version of chronoforms V4.
<?php
$db =& JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `tt7vy_chronoforms_data_Spargelturnier_2014`
WHERE `Selector` = '1' ;
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count > 4 ) {
// redirect the user
header( 'Location: http://www.bsvslr.de/index.php/wir-sind-voll.html' ) ;
}
?>
I do not find the mistake. DB table is correct, Selector is set.
Can someone help me?
Hi thyl123,
It looks OK to me; I use XAMPP and would expect that to work, though I wouldn't use location() for the redirection but the Joomla! $mainframe->redirect();
Where exactly do you have this code? Have you checked the query in PHPMyAdmin?
Bob
It looks OK to me; I use XAMPP and would expect that to work, though I wouldn't use location() for the redirection but the Joomla! $mainframe->redirect();
Where exactly do you have this code? Have you checked the query in PHPMyAdmin?
Bob
I think i got the error: I have JOTCache installed
--> The message couldn't appear, because the side was cached.
That was the problem. I excluded Chronoforms from caching, now it works.
Only question: How do I use this code?
--> The message couldn't appear, because the side was cached.
That was the problem. I excluded Chronoforms from caching, now it works.
Only question: How do I use this code?
$mainframe->redirect(http://www.bsvslr.de/index.php/wir-sind-voll.html);
That doesn't work.
This topic is locked and no more replies can be posted.