Hi Eric,

First of all I think this is a very useful module. Thanks for your efforts!

I just tested your module a while ago and observed the ff (I'm using 4.6):

1) Whenever a user tries to post an entry for a content type (in my case flexinode content type) for which the module is enabled, there is a warning:

warning: Invalid argument supplied for foreach() in /home/mysite/public_html/modules/user_related_content/user_related_content.module on line 297.

2) a new "n new comments link" (where n is the number of contents) appears in a specific node -- I think this appears in all nodes, not just the user_related_content-enabled nodes -- making the old "n comments" link redundant.

3) Even if a node is unpublished, it still shows in the "related content" page (found in profile page; when a viewer clicks on the "unpublished" node, it is inaccessible, of course).

I will still test it later perhaps if I can still find any issues.

***

The reason I stumbled upon your module is because I'm trying to solve this problem:

http://drupal.org/node/32059

Since your module somewhat tackles the same problem, if it's not too much to ask, I'm hoping that you might suggest a solution? But if you find that it's a totally different problem, then it's okay -- there's still the option of using your module. :)

Thanks in advance and keep up the great work! :)

Comments

dbarach’s picture

I wanted to add that I've seen exactly the same problem with the "Invalid argument supplied for foreach()" error, except that I'm getting it in node/add for every node that is user-related-content enabled.

Is there a configuration conflict?

I look forward to hearing from you, and keep up the good work! This module is great.

maui1’s picture

I am getting the same error, just by selecting a node type to add. Could this be an incompatibility with osme other module.

What none core modules have you all added.

I have Audio, video, Bookmarks, html area, jsdomenu, tax-browser, tax-dhtml, Article

Michael Hofmockel’s picture

Title: Issues I found » Hack solution to Warning on ?q=node/add/(related node type)

re: warning: Invalid argument supplied for foreach() in home/mysite/public_html/modules/user_related_content/user_related_content.module on line 297.

I also experienced the warning with a fresh load of:
Drupal 4.6.4
profile.module
user_related_content.module

I hacked the following solution below:
*note - replace 'flexinode-1' with your own related node type.

Replace

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);
}

with

if(!$_GET[q]=='node/add/flexinode-1') {
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);
}
}

Hopefully a true solution will come soon. As this module is really great!

ejort’s picture

Assigned: Unassigned » ejort

Sorry for not replying earlier, I've just started a non-PHP job and haven't had much time to follow up these issues.

I've seen this warning myself on occasion. I'm not checking whether an array is set before doing foreach(...) in a few places. The warning won't cause any problems however, it's just annoying. Hopefully I'll find some time to fix this in the next week or two (between christmas and new years is likely).

Cheers,
Eric

ejort’s picture

Status: Active » Fixed

1 and 3 should be fixed now, but I can't reproduce 2, so I'll close the issue until somebody else can reproduce this.

Anonymous’s picture

Status: Fixed » Closed (fixed)
feliflor’s picture

If you are running a large(r) site, you will probably want to store your files on a dedicated mount (drive, NFS etc.), say /media/nfs-example-com/.

_________________________
Pilates