After new content is created which triggers an immediate notification, the follow warning appears multiple times:
warning: in_array() [function.in-array]: Wrong datatype for second argument in /srv/www/vhosts/lis.luther.edu/htdocs/modules/notify_by_views/notify_by_views.module on line 345.

On my system, it appears 20 times -- equal to the number of views which are not enabled in Notify by Views.

Comments

matt2000’s picture

Status: Active » Needs review

I wasn't able to replicate directly, but I think I see what's happening. I've just committed a fix. Please give it a try.

Thanks for sticking with this; I haven't had as much time as I hoped with this module, but your testing and reports are a big help.

gjerdery’s picture

After applying the patch, I saw the same results as before. However... I changed this:

foreach (variable_get('notify_by_views_select_views', array()) AS $key => $view_name) {
          if (!$key && !$view_name) continue; //bail if this is an unselected view

to this:

foreach (variable_get('notify_by_views_select_views', array()) AS $view_name) {
          if (!$view_name) continue; //bail if this is an unselected view

(lines 223-224) and the warning goes away! I don't think this will introduce other unusual behavior.

matt2000’s picture

Both are rough hacks.

I checked the key because I noticed that having no views selected could introduce an element with key = 0, value=1.

I know theres a smarter way to do this; I just haven't had time to think it through yet.

gjerdery’s picture

To address the case you mention above, would (!$key || !$view_name) be the correct test?

matt2000’s picture

Status: Needs review » Needs work

Yes, although, I still think there a more elegant way to do it.

ron collins’s picture

that worked for me, thanks.

matt2000’s picture

Status: Needs work » Fixed

Using the OR check for now, as it does the job.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.