Fixed Notices in Media Gallery

Mr Lucky

Well-known member
The notice system page criteria allows you to specify a template e.g.

xengallery_media_index

as well as categories

However if you do that it displays in neither, then throws up an error on the category page:

An exception occurred: in_array() expects parameter 2 to be array, null given in /public_html/library/XenGallery/Listener.php on line 340

Code:
An exception occurred: in_array() expects parameter 2 to be array, null given in /home/caf/public_html/library/XenGallery/Listener.php on line 340

XenForo_Application::handlePhpError()
in_array() in XenGallery/Listener.php at line 340
XenGallery_Listener::criteriaPage()
call_user_func_array() in XenForo/CodeEvent.php at line 90
XenForo_CodeEvent::fire() in XenForo/Helper/Criteria.php at line 538
XenForo_Helper_Criteria::pageMatchesCriteria() in XenForo/ViewRenderer/HtmlPublic.php at line 228
XenForo_ViewRenderer_HtmlPublic->_getNoticesContainerParams() in XenForo/ViewRenderer/HtmlPublic.php at line 128
XenForo_ViewRenderer_HtmlPublic->renderContainer() in XenForo/FrontController.php at line 618
XenForo_FrontController->renderView() in XenForo/FrontController.php at line 158
XenForo_FrontController->run() in /public_html/index.php at line 13
 
Last edited:
Admittedly, that type of error should never be shown and so I have fixed that for the next release.

However, this would only happen if you don't select a category:

upload_2014-11-13_13-51-53.webp

You actually need to select the categories you want the notice to show in:

upload_2014-11-13_13-52-19.webp

If you do that, the error will not be shown.

It's worth noting, though, that when the fix rolls out for this, in your current set up (no categories selected), the notice would be ignored and just not show.
 
It seems to be an issue even with categories selected

More specifically:

  • If you have just a content template for the notice - it works fine
  • If you select one or more categories but no content template - it works fine (as expected showing on this categories)

But:

If you have both a content template and one or more categories selected, it shows on neither (and sometimes causes an error but not always it seems)

So it seems to me you should not be allowed to have both a content template and categories selectable.
 
If you have both a content template and one or more categories selected, it shows on neither
That's expected.

You're telling the notice to show on template xengallery_media_index AND in category X. The template being loaded on category pages would be xengallery_category_view, so it simply isn't possible to match your criteria.

You can't be in a category and on the media index at the same time.
 
That's expected.

You're telling the notice to show on template xengallery_media_index AND in category X. The template being loaded on category pages would be xengallery_category_view, so it simply isn't possible to match your criteria.

You can't be in a category and on the media index at the same time.

That's fair enough, but in that case you shouldn't be allowed to actually do both in the Notices options

ie with both options there it makes you think it should be possible and so it's rather confusing.
 
It's just how notices work for everything, and how they have always worked. It just requires a thought process to analyse the criteria you're providing is logical and possible. There's quite a few cases where you can apply a criteria that is impossible to fulfil.
 
It can't know that. The criteria can be combined together, you're just using something that isn't impossible. It's roughly equivalent to setting the criteria to be both a registered user and a guest; here, you're making a situation where it can't be possibly by requiring a template that isn't used in a category and that you're in a particular category.
 
Yes, I totally understand that now
It just requires a thought process to analyse the criteria you're providing is logical
but those of us with a bit less brains or different kinds of thought process or knowledge of the intricacies of forum software can be easily confused. I just thought it would be better for non-techies or less logical people to not have the option to do impossible things which actually appear on the face of it to be possible.

Or you could just have some text saying: "You can't do both"
 
Top Bottom