I have a site mostly targeted for registered users but I want to provide guests (potential new users) with registration form. This registration form is a Menu item publicly available (it consists of a component with one module). In helper class of the module I have a very simple query as I need to fetch one data from my joomla database before processing the form data:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('params'))
->from($db->quoteName('#__mytable'))
->where($db->quoteName('name') . '=' . $db->quoteName('something'));
$db->setQuery($query);
$params = $db->loadResult();
The problem is that I am getting redirected to login page on executing this part of code (I didn't have this problem before so I am sure it is connected with JFactory::getDbo
or something with db connection). I guess it is because of the permissions to enable access to db only for logged-in users.
Is it possible to get around this problem without security breaches? Any help appreciated.
JFactory::getDbo()
. Are you sure you've set the access level for the actual module topublic
? Also, where is the rest of the code for the module? A redirect ony occurs if you specify one and it's not coming from your database query.