I am seeing this error when attempting to include commons_follow_node as a part of a site distribution. Unsure if you guys can support this since its outside the realm of a full commons build. In any case, here's what happens when I try to use drush to do a site-install with this module included in the [distro].info

Warning: in_array() expects parameter 2 to be array, null given in commons_follow_node_follow_node() (line 82 of commons_follow/commons_follow_node/commons_follow_node.module).

It seems that, during my install, the flag types are not yet available to flag_get_flag()

Here's the code block:

/**
 * Let a user to follow a node.
 *
 * @see commons_follow_node_comment_insert                                                                                                              * @see commons_follow_node_node_insert
 */
function commons_follow_node_follow_node($nid, $content_type, $user_id = NULL) {
  $flag = flag_get_flag('commons_follow_node');

  // Check if this content type use the "Individual nodes" flag
  if (in_array($content_type, $flag->types)) {
    $account = isset($user_id) ? user_load($user_id) : NULL;
    $flag->flag('flag', $nid, $account);
  }
}

Patch attached doublechecks that the $flag object is returned. This prevents the drush site-install hiccup on my end.

Comments

saltednut’s picture

Status: Active » Needs review
Issue tags: +demo_framework

status/tags change

saltednut’s picture

Version: » 7.x-3.2
Status: Needs review » Closed (cannot reproduce)
Issue tags: -demo_framework

This seems to be fixed I haven't had the problem as of 3.2