I have a dynamic article in Joomla.
The article information is extracted from fabrik when the user is logged in.
But when the user is not logged.. I can not see the information.
The idea is to create a url .. something similar to this:
https://qrmenudigital.com/index.php?option=com_content&view=article&id=32&uid=969
adding the article_id and the user_id.. that must be shown.
I want to give this url to the people that need to see this article.
For people that are not registered users -- they see the article.
The article is a dynamic article, and I add this code in PHP to extract data:
{source}<?php
$user = JFactory::getUser();
$userId = $user->get('id');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
//echo $userId;
$query->select($db->quoteName(array('nombre_establecimiento', 'user_id',)))
->from($db->quoteName('insertar_logo'))
->where($db->quoteName('user_id') . ' = ' . $userId);
$db->setQuery($query);
$results = $db->loadAssocList();
foreach ($results as $rows) {
echo "<center>";
//echo "<img src='images/stories/" . $userId . "/image-1.png'>";
echo "<H1>" . $rows['nombre_establecimiento'] . "</H1>" . "<BR>";
echo "</center>";
}
?>
{/source}
If the user is logged in, the article show the data.
But when I try to use the link to show the article without the logged-in user, I can not see anything.
How can I relate the link with the article if the user is not logged in?
->
in your real code, right? You have->
and this was just a question posting error?