Issue is on our test site online but does not appear on the version hosted on my PC, so tricky
Home Page articles displayed
Articles not displayed
Jooml1 4.3.1
I have tracked it down to components\com_content\src\Model\FeaturedModel.php
On my local machine the result returned from $featuredCategories = $this->getState('filter.frontpage.categories'); is an empty array, which is what I expect
But on the online testsite it returns (from an insrted print_r)
Array ([0]=>) - ie an empty array element. This then results in the code generating a WHERE of catid IN (0) which fails.
Both sites are same Joomla version.
| Labels |
Removed:
?
|
||
| Labels |
Added:
No Code Attached Yet
|
||
As far as I can tell. But the fact remains that on one the query to set the categories returns a strange array. Unfortunately Joomla's diagnostics show the SQL prepared statement before the substitutions are made, so it's quite hard to actually recreate it, but I will try to do that and run it in phpMyAdmin. Will post again alter when I have done it
OK - the query that is used to get the categories in line 157 of FeaturedModel is
SELECT a.id,a.title,a.alias,a.introtext,a.fulltext,a.checked_out,a.checked_out_time,a.catid,a.created,a.created_by,a.created_by_alias,a.modified,a.modified_by,CASE WHEN a.publish_up IS NULL THEN a.created ELSE a.publish_up END AS publish_up,a.publish_down,a.images,a.urls,a.attribs,a.metadata,a.metakey,a.metadesc,a.access,a.hits,a.featured,a.language,LENGTH(a.fulltext) AS readmore,a.ordering,fp.featured_up,fp.featured_down,CASE WHEN c.published = 2 AND a.state > 0 THEN 2 WHEN c.published != 1 THEN 0 ELSE a.state END AS state,c.title AS category_title,c.path AS category_route,c.access AS category_access,c.alias AS category_alias,c.language AS category_language,c.published,c.published AS parents_published,c.lft,CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author,ua.email AS author_email,uam.name AS modified_by_name,parent.title AS parent_title,parent.id AS parent_id,parent.path AS parent_route,parent.alias AS parent_alias,parent.language AS parent_language,fp.ordering
FROM blpj3_content AS a
LEFT JOIN blpj3_categories AS c ON c.id = a.catid
LEFT JOIN blpj3_users AS ua ON ua.id = a.created_by
LEFT JOIN blpj3_users AS uam ON uam.id = a.modified_by
LEFT JOIN blpj3_categories AS parent ON parent.id = c.parent_id
INNER JOIN blpj3_content_frontpage AS fp ON fp.content_id = a.id
WHERE (fp.featured_up IS NULL OR fp.featured_up <= '2023-05-30 05:34:37') AND (fp.featured_down IS NULL OR fp.featured_down >= '2023-05-30 05:34:37') AND a.access IN (1,5) AND c.access IN (1,5) AND c.published = 1 AND a.state = 1 AND (a.publish_up IS NULL OR a.publish_up <= '2023-05-30 05:34:37') AND (a.publish_down IS NULL OR a.publish_down >= '2023-05-30 05:34:37') AND a.catid IN (0)
ORDER BY c.lft, a.featured DESC, fp.ordering, CASE WHEN a.publish_up IS NULL THEN a.created ELSE a.publish_up END DESC , a.created DESC LIMIT 4
which when run on phpMyAdmin correctly returns nothing (as it does on my local PC) and as a result there is no WHERE clause containing catid.
If however I run it in the Joomla website and print_r the result it gives Array ( [0] => ). This then results in have a WHERE of catid in (0) and I get no articles returned.
You can see this in action at j4.birdlifephotography.org.au, where the print_r shows as RETURNED and the SQL can of course be seen in the Joomla tracing
Are you sure that categories with featured articles are public?
Are you sure that categories with featured images are public?
I really think that the forum is best for this issue
Both article are "uncategorised" and that is set to "public". And they are all published.
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-06-01 10:31:44 |
| Closed_By | ⇒ | alikon |
Hello,
Thank you for submitting your issue request on the Joomla issue tracker. We appreciate your engagement and your contribution to improving the Joomla project.
However, the issue tracker is primarily used for reporting and tracking bugs and feature requests. For questions and discussions, we encourage you to post your query on the Joomla forum. The forum is a great platform to engage with the Joomla community and get assistance from experienced users and developers.
Please visit the Joomla forum at [forum.joomla.org] and post your question there. We're confident that you'll receive valuable insights and assistance from the community.
Thank you for understanding, and we look forward to seeing you on the Joomla forum.
Best regards,
Nicola Galgano
Joomla Bug Squad Team
Seems an obvious question but are both sites 100% identical