Heyho.
At first: I´m very gladful that these module exists ;)
I use AJAX Comments with Inline AJAX Comments für my organic groups.
If I load a group there are these two error messages, no matter how much comments or group contents there are.
Notice: Undefined property: stdClass::$content in ajax_comments_panels_pane_content_alter() (Zeile 326 von ...\sites\all\modules\ajax_comments\ajax_comments.module).
Notice: Undefined property: stdClass::$content in ajax_comments_panels_pane_content_alter() (Zeile 326 von ...\sites\all\modules\ajax_comments\ajax_comments.module).
May be its helpful to know it.
If I shoul add some information, please tell it.
cya
Garm
Comment | File | Size | Author |
---|---|---|---|
#8 | ajax_comments-check_for_content-1812572-8.patch | 1.18 KB | jweowu |
#4 | check_for_content-1812572-3.patch | 699 bytes | dagomar |
#1 | check_for_content-1812572-2.patch | 577 bytes | dagomar |
Comments
Comment #1
dagomar CreditAttribution: dagomar commentedThis had me stumped for a bit. What happens here is that in some cases there will be no content, because of comment settings. In these cases we can assume no AJAX Comments functionality is necessary because:
1. Comment setting is closed and no previous comments exist.
2. Previous comments exist and comment setting is set to hidden.
We simple do not want AJAX Comments to do anything if $content->content is not set. I've added a patch.
Comment #2
dagomar CreditAttribution: dagomar commentedComment #3
dagomar CreditAttribution: dagomar commentedSilly me, if there are no comments yet, this won't print the needed div. I'll rework and post this later, I need this working today, but ignore the patch in #2
Comment #4
dagomar CreditAttribution: dagomar commentedHere is a new patch. I needed to check the context to see if the comments need to be printed or not. It follows exactly how Drupal does this on it's own, with the exception of when commenting is allowed but no comments have been made yet. In that case the pane needs to be printed, thus only rendering the title. I think it would be nice to have some initial content there ('Be the first to post a reaction' - or something like that). For that some extra refacturing is needed because that text needs to be removed after a first comment is posted. Another option could be to empty the title, I think... But perhaps this is not the place for that.
Comment #5
dagomar CreditAttribution: dagomar commentedComment #6
jweowu CreditAttribution: jweowu commentedI note that the function still tries to use
content->content
if it makes it past the code you've added, but your code never sets that property.I haven't examined what you're doing here, but can you confirm whether you've ensured that, if it gets that far, there's definitely a
content
property to use?(e.g. If the call to
ctools_content_render()
inrender_pane_content()
returnsNULL
)There are some coding standards formatting issues to fix up, in any case.
Comment #7
jweowu CreditAttribution: jweowu commentedI've re-written that patch (coding standards formatting; use of COMMENT constants; allow for
$content
beingNULL
).The bit I'm not sure of is obtaining the node from
$context
. I didn't like the assumption that the first element of the context array held a node, but I also got lost in the ctools context code looking for a way to ask explicitly for a 'node' or 'entity:node context' (although it's also not clear to me whether those are the only possibilities). I've gone with something which I think is better than before, but could be improved if a suitable API call does exist.Comment #8
jweowu CreditAttribution: jweowu commented(see previous comment)
Comment #9
formatC'vt CreditAttribution: formatC'vt commentedtry latest release please
Comment #10
jweowu CreditAttribution: jweowu commentedIt looks like the relevant code for this issue has been refactored out of existence, so we should probably close this issue.
Comment #11
formatC'vt CreditAttribution: formatC'vt commentedok