Hello,
I am trying to debug my form. I put a debugger on the very last position in the on submit event.
Apart from the debugger there is a custom code element with this code:
This code doesn't seem to get execute though, or it fails on the addUserToGroup method.
The debugging information after hitting the submit button is not shown. It just reloads the page. Do i have to enable something else?
I am trying to debug my form. I put a debugger on the very last position in the on submit event.
Apart from the debugger there is a custom code element with this code:
<?php
$group_id_clanmembers = 11;
$group_id_registered = 2;
$user_id = intval($form->data['player']);
jimport( 'joomla.user.helper' );
JUserHelper::addUserToGroup($user_id, $group_id_registered);
JUserHelper::removeUserFromGroup($user_id, $group_id_clanmembers);
$db =& JFactory::getDBO();
$query = "update #__players set clan_id = null WHERE user_id = $user_id";
$db->setQuery($query);
$db->query();
?>
This code doesn't seem to get execute though, or it fails on the addUserToGroup method.
The debugging information after hitting the submit button is not shown. It just reloads the page. Do i have to enable something else?
Hi Moh-Aw,
Please try this version
Bob
Please try this version
<?php
$group_id_clanmembers = 11;
$group_id_registered = 2;
$user_id = intval($form->data['player']);
jimport( 'joomla.user.helper' );
\JUserHelper::addUserToGroup($user_id, $group_id_registered);
\JUserHelper::removeUserFromGroup($user_id, $group_id_clanmembers);
$db = \JFactory::getDBO();
$query = "
UPDATE `#__players`
SET `clan_id` = null
WHERE `user_id` = $user_id;
";
$db->setQuery($query);
$db->execute();
?>
The main changes are to add the \J. . . as Max has put the ChronoForms code inside a separate namespace in CFv5 and to replace $db->query() with $db->execute - a Joomla! 3 change.
Bob
Thanks for the quick response. Unfortunately it's still not doing anything and the debug info isn't showing anything either.
I have a different form (which is the counterpart to the form above) which works perfectly with the following code:
I have a different form (which is the counterpart to the form above) which works perfectly with the following code:
<?php
$user =& JFactory::getUser();
$group_id_clanmembers = 11;
$group_id_registered = 2;
$user_id = $user->id;
jimport( 'joomla.user.helper' );
JUserHelper::addUserToGroup($user_id, $group_id_clanmembers);
JUserHelper::removeUserFromGroup($user_id, $group_id_registered);
$authGroups = $user->getAuthorisedViewLevels();
$clan = $form->data['clan_id'];
$db =& JFactory::getDBO();
$query = "update `#__players`
set `clan_id` = $clan
where `user_id` = $user_id";
$db->setQuery($query);
$db->execute();
?>
Hi Moh-Aw,
I can only suggest that you debug your custom code.
+ Set site error reporting to Maximum temporarily and see if you get any PHP error messages.
+ Add echo statements to the code to output variables.
+ Comment out most of the code until you get some output, then remove the comments line by line until you find the point where the error is.
Bob
I can only suggest that you debug your custom code.
+ Set site error reporting to Maximum temporarily and see if you get any PHP error messages.
+ Add echo statements to the code to output variables.
+ Comment out most of the code until you get some output, then remove the comments line by line until you find the point where the error is.
Bob
I have done what you wrote but it's not showing anything (no echo message from the code and no errors from the error reporting). After that I actually replaced everything in "onSubmit" with a "display message" module followed by a show stopper.
All it does is reload the page.
All it does is reload the page.
After looking at the source code in firefox i found that I have a form in a form. I'm calling the chronoform with the plugin in an article that already contains a form.
I'll try to find out how I solved this the last time.
I'll try to find out how I solved this the last time.
This topic is locked and no more replies can be posted.