When editing an already existing own comment, and saving ones edits, the following error message is getting displayed at the top of page:

Notice: Undefined variable: original in commons_radioactivity_comment_update() (line 45 of [...]/profiles/commons/modules/contrib/commons_radioactivity/includes/incidents/commons_radioactivity.incidents_comment.inc).
Notice: Trying to get property of non-object in commons_radioactivity_comment_update() (line 45 of [...]/profiles/commons/modules/contrib/commons_radioactivity/includes/incidents/commons_radioactivity.incidents_comment.inc).

Experienced with: Drupal Commons 7.x-3.1+1-dev

This can be fixed by exchanging line 45 profiles/commons/modules/contrib/commons_radioactivity/includes/incidents/commons_radioactivity.incidents_comment.inc with this:

$comment_change = $comment->status + $comment->original->status;

Because that's the way how the original comment is saved within a comment object in Drupal 7 [source]. I have however not checked the logic behind calculating that sum, means I trust you folks that this is correct :)

Comments

stupiddingo’s picture

This error also exists in Commons 7.x-3.2 and 7.x-3.x-dev

The solution tanius describes above works well. With this small fix, I'm not seeing anymore errors from comment editing, and works cleanly for all CRUD. Logic looks sound to me, and I suspect the $original->status was just a typo.

Patch attached for review.

stupiddingo’s picture

Status: Active » Needs review

Changing status to "needs review" rather than just talking about it. Doh.

japerry’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Commons 7.x-3.3 radar

Looks good to me!

devin carlson’s picture

StatusFileSize
new66.96 KB
new95.01 KB

Tested #1 which still applies cleanly and fixes the error.

comment_update_error.png

comment_update_no_error.png

devin carlson’s picture

Status: Reviewed & tested by the community » Fixed

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