Joomla 3.2.2 issue: Notice: Undefined variable: nowDate /components/com_content/models/articles.php

邮差的信 提交于 2019-12-14 04:09:02

问题


I have modified my joomla latest news module to make it displaying only articles from the latest month by adding these lines to the helper.php

$model->setState('filter.date_filtering', 'relative');
$model->setState('filter.relative_date', 30);

It works good until I upgraded my joomla installation to the latest Joomla 3.2.2 today. It works properly for public access and registered user, but when I login as a admin user in the frontend it returns a blank output and when I set the error reporting to the development level it returns these error messages :

Notice: Undefined variable: nowDate in xxx/components/com_content/models/articles.php on line 471

Warning: Invalid argument supplied for foreach() in xxx/components/com_content/models/articles.php on line 546

Warning: Invalid argument supplied for foreach() in xxx/modules/mod_articles_latest/helper.php on line 105

Warning: Invalid argument supplied for foreach() in xxx/modules/mod_articles_latest/tmpl/default.php on line 13

When I looked at the com_content/models/articles.php, and comparing it with the old 3.2.1 version I found that this new line added in the j 3.2.2 version :

if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))) {

If I delete this line then everything back to normal.

My questions is, is it something considered a joomla 3.2.2 bug or not? If it's not, how can I modify the module code to allow me displaying only articles from the latest 30 months without modifying the articles.php?

Thank you


回答1:


I've submitted a patch for this issue.

See the issue tracker item.

Here is the PR and the patch:

For Joomla 3.2

https://github.com/joomla/joomla-cms/pull/3084

https://github.com/joomla/joomla-cms/pull/3084.diff

https://github.com/joomla/joomla-cms/pull/3084.patch

For Joomla 2.5.x

https://github.com/joomla/joomla-cms/pull/3085

https://github.com/joomla/joomla-cms/pull/3085.diff

https://github.com/joomla/joomla-cms/pull/3085.patch



来源:https://stackoverflow.com/questions/21641365/joomla-3-2-2-issue-notice-undefined-variable-nowdate-components-com-content

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!