Hi, Thanks for great module.

But there is a problem in my site. When i try to show relevant content in CCK type. It shows a warning message. What can i do for solve this problem. Thank you.

warning: Invalid argument supplied for foreach() in /opt/modules/relevant_content/relevant_content_cck/relevant_content_cck.module on line 226.

Comments

asb’s picture

Hi,

I'm getting similar errors with D5 version:

...
warning: Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/relevant_content/relevant_content_cck/relevant_content_cck.module on line 99.
warning: Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/relevant_content/relevant_content_cck/relevant_content_cck.module on line 211.
...

When this error appears, no related content is displayed. I'm using the CCK "relaed content" field, embedded into a fieldgroup. Node type: vanilla "article" (plus a bunch of CCK fields), one term from one vocabulary; the error appears also, when the node is tagged with two terms from two vocabularies.

I think, the reason for this error message is that no exactly matching content is available (the "related content" algorithm seems to be pretty simple; as far as I understand it, it does not evaluate text from the node's title or body to evaluate similarity (like the "Similar" module does, resulting in far better results).

Try adding content in the same category and have a look if the error disappears. If I'm right, maybe the error message simply should be suppressed or changed to a translatable string like "There is no related content available".

Greetings, -asb

aterchin’s picture

errors upon activating both modules:

warning: Invalid argument supplied for foreach() in path_to_drupal_root_directory\includes\form.inc on line 1200.
warning: Invalid argument supplied for foreach() in path_to_drupal_root_directory\includes\form.inc on line 1200.

step two, add the relevant content cck field, get about two of these for each post on visiting the homepage with all the teasers, field set to display teasers.

warning: Invalid argument supplied for foreach() in /home1/reptilew/public_html/plasticapple/sites/all/modules/cck/content.module on line 1284

Goes away when display set to 'title-link'.

nicholasthompson’s picture

Status: Active » Postponed (maintainer needs more info)

I'll have to take a look at this. Thanks.

nicholasthompson’s picture

asb’s picture

Priority: Normal » Critical

Hi,

I'm setting this issue to "critical" since it breaks a lot of widely used other modules, e.g. "Views Bulk Operations" (VBO), and relevant_content_cck.module has to be disabled every time they're being used.

The patch provided in #331625: foreach/sql errors when creating CCK fields fixes the issue for D5 sites, but doesn't work for D6. However, even for D5 a new release including the patch would be nice ;)

Greetings, -asb

ruharen’s picture

I'm getting this error too with Relevant Content CCK module but only for nodes that DO NOT have related nodes.

tormu’s picture

This worked for me: http://drupal.org/node/331625#comment-1204192
I was also getting the same error as the original poster, line 226