I have a form today CF v4 where I use Event-Switcher [GH]. Is the app for CF v5 similar to that.
I have this code:
In CFv4 it works but when I try to use the same code in CFv5 nothing happens.
//JeLu
I have this code:
<?php
$user =& JFactory::getUser();
$user_id = $user->id;
$pnr = '';
if ( isset( $form->data['pnr'] ) ) {
$pnr = $form->data['pnr'];
}
if ( !preg_match( "/^\d{8}\-\d{3}\w{1}$/", $pnr ) ) {
return 'event_b';
$form->errors[''] = 'My error message';
}
$db =& JFactory::getDBO();
$query = "
SELECT *
FROM `#__my_table`
WHERE `pnr` = {$db->quote( $pnr )};
";
$db->setQuery($query);
$rows = $db->loadObject();
$actual_user = $rows->cf_user_id;
$pnr_exist = $rows->pnr;
if ( $actual_user == $user_id) {
return 'event_a';
}
elseif ( $pnr_exist ) {
return 'event_d';
}
else {
return 'event_c';
}?>
In CFv4 it works but when I try to use the same code in CFv5 nothing happens.
//JeLu