Hello,

I'm getting a blank page with this error when trying to access the main RedHen activity stream page or a contacts activity stream tab:

Fatal error: Cannot access empty property in /.../sites/all/modules/redhen/modules/redhen_activity/redhen_activity.module on line 685

I'm checked the error logs and found these three errors were created at the same time as the above:

Notice: Undefined variable: source in redhen_activity_activity_page() (line 587 of /Users/curtis/Dropbox/WEBWORK/_LOCAL/AMPPS/www/sirc/sites/all/modules/redhen/modules/redhen_activity/redhen_activity.module).

Notice: Undefined variable: ref_entity_type in redhen_activity_source_entity() (line 685 of /Users/curtis/Dropbox/WEBWORK/_LOCAL/AMPPS/www/sirc/sites/all/modules/redhen/modules/redhen_activity/redhen_activity.module).

Notice: Undefined variable: ref_field in redhen_activity_source_entity() (line 685 of /Users/curtis/Dropbox/WEBWORK/_LOCAL/AMPPS/www/sirc/sites/all/modules/redhen/modules/redhen_activity/redhen_activity.module).

I'm running Drupal 7.26 with RedHen and Drupal Commerce installed. Anyone else getting these errors? Any help or guidance would be greatly appreciated.

Thanks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hommesreponse’s picture

Status: Active » Closed (fixed)

After fleshing out some of the Contacts with Organization connections and adding memberships the errors magically went away!

BillMounce’s picture

Status: Closed (fixed) » Active

I have filled out every category of information, all the types, and include sample Contacts and Organizations. When I try to go to the Activity stream for the site, I used to get this message (above), and now I get a generic:

Error

The website encountered an unexpected error. Please try again later.

jwjoshuawalker’s picture

This will happen if you have defined other message types (message.module).

The RedHen "activity stream" loads all message types/bundles, regardless of if RedHen defined them, then attempts to access an entity reference field that only exists on its RedHen message bundles (by default).

That part of line 685 in redhen_activity.module:

$message->{$ref_field}[LANGUAGE_NONE][0]['target_id']

Where $ref_field = message_redhen_contact or message_redhen_org

I have a few ideas for solutions. The most appropriate I think will be changing function redhen_activity_activity_page() to only look for RedHen message types.

For a quick fix, to rid the error, you can add a "default" case to the

switch($message->type)

in redhen_activity_source_entity() that just returns nothing. Note that non-RedHen messages will still show up in the RedHen activity log if you go this quick route.

jwjoshuawalker’s picture

Version: 7.x-1.7 » 7.x-1.x-dev
Component: redhen_contact » redhen_fields
Category: Support request » Bug report
Status: Active » Needs review
FileSize
571 bytes
544 bytes

I do still think the function redhen_activity_source_entity() could gracefully handle if a different bundle is coming through, or the ref field isn't present/is empty.

Here are 2 patches, 2 slightly different options. Take your pick.

CountPacMan’s picture

Status: Needs review » Reviewed & tested by the community

Unable to replicate error. Defined new message type and viewed the main RedHen Activity stream. Code in patch 1 is clean and introduces no errors. Just based on redhen_activity_source_entity(), I can see how this can be an issue in some cases, but was not able to replicate the error. I will try to get the first patch committed.

levelos’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the help gang. Fixed the underlying issue by only returning RedHen message types. Ref #65edbd7ebc43152a1e0d38b948bdbd1e688f0932.

Status: Fixed » Closed (fixed)

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