When opening up a node/add/[type] composition form, the following error is generated in the watchdog:
Invalid argument supplied for foreach() in /home/blogher/public_html/modules/user_related_content/user_related_content.module on line 297.
The module seems to work, but this is my first time trying it out so maybe I don't know what I'm missing.
The relevant area in the module is:
foreach ($relationship_types as $relationship_type) {
$i = 0;
$items = '';
foreach ($node->user_related_content[$relationship_type->rtid] AS $i => $name) {
$items .= form_textfield(t('related user'), 'user_related_content][' .$relationship_type->rtid. '][' .$i, $name, 50, 50);
}
The 2nd "foreach" line is line 297 of user_related_content.module,v 1.3.2.3 2005/09/07 15:08:16. Running on Drupal 4.6.5.
Thanks.
Comments
Comment #1
laura s commentedChanging to critical because, between this error and the error reported in http://drupal.org/node/44554, this module does not store any relationship info. In other words, it does not function properly. When you're working with it, the user related content links seem to be created. But they disappear between sessions.
Further info (perhaps related): In phpMyAdmin, I am given this error warning for the mysql table user_related_content_relationship_type_content_types:
PRIMARY and INDEX keys should not both be set for column `rtid`Hope this helps. (Cross-posting this info on http://drupal.org/node/44554.)
Comment #2
keve commentedPatch for "Invalid argument supplied for foreach() " on line 297
Comment #3
laura s commentedI tried the patch and no longer get this error. From what I can tell, the module is functioning now. (However, I offer the caveat that the module seemed to be functioning before, but seemed to "forget" which nodes were associated with which users.)
FYI I am still getting the error noted in http://drupal.org/node/44554, so the issues do not seem to be related.
Comment #4
ejort commentedPatch committed to 4.6 branch, thanks keve.
laura s, if you're still having problems can you let me know? As far as I can see this error shouldn't have stopped the module from saving it's information.
Eric
Comment #5
laura s commentedAs far as I can tell, the module is now saving information. If not, I will follow up.
However, I'm still getting this error:
mysql_real_escape_string() expects parameter 1 to be string, array given in /home/blogher/public_html/includes/database.mysql.inc on line 239....every time I view the "Related Content" tab or a display of the actual related content (as defined by the relationships).
Comment #6
ejort commentedHi laura,
I've committed a fix for the last issue as well, don't forget to open a new issue for different problems though! (I'm likely to lose track of them otherwise) :-)
Cheers,
Eric
Comment #7
(not verified) commented