Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, the activity stream is showing unpublished comments.
How can this be resolved?
thanks in advance
Comment | File | Size | Author |
---|---|---|---|
#4 | Untitled.png | 7.3 KB | blogook |
Comments
Comment #1
Stalski CreditAttribution: Stalski commentedIn heartbeat you have two types of comment usage. When a heartbeat activity has a node involved, it will be found and together with enabled node-context configuration, heartbeat will load and post "normal drupal comments".
I checked the query and only published comments are fetched.
If not in node context, the system will use heartbeat_comments, which don't have status fields.
So could you explain what you mean by unpublished comments?
However, I can remark that you sometimes can see unpublished comments when that comment text is embedded in your heartbeat message. E.g.
!username commented on !title: !my_comment (which_is_unpublished_but_this_message_isnt)
And that is normal behavior as this is out of heartbeat's control.
Comment #2
blogook CreditAttribution: blogook commentedThe unpublished comments are shown in site activity stream.
When a user comments on a post it has to be approved before it is published by the admin. So I am guessing it is moderation status? And these comments are shown in the stream.
Comment #3
Stalski CreditAttribution: Stalski commentedPlease read what I said. This is impossible, only in the way I described and that's out of heartbeat's control.
Can you send me screenshots please to make sure it are COMMENTS that are displayed unpublished.
Comment #4
blogook CreditAttribution: blogook commentedSure ..
Attached a screenshot, I added a comment on a blog posting saying, this is an unpublished comment. And *it is* actually an unpublished comment.
And the stream you are looking at is the site-activity stream.
Comment #5
Stalski CreditAttribution: Stalski commentedSo it's a I mentioned. It's not the comment you are showing. You are embedding a comment in a heartbeat message. The message does not know if that comment is published or not.
There are two ways to look at this:
- You check the comment status at time of logging. (You could do this in the rules UI, creating a condition "When a comment is published".
The disadvantage here is that it does not represent the status of the comment at display time. So you could do this but it "might" not be enough.
- You check the comment status at display time. And this seems a little harder as I see it.
I am currently trying to fix something. The "comment id" is never written to the database, so I might have a generic solution for this one.
Hang in there.
Comment #6
blogook CreditAttribution: blogook commentedAny help will be greatly appreciated .. as i am a complete noob when it comes to rules :)
Comment #7
Stalski CreditAttribution: Stalski commentedSidenote: Well as I said, if you are a programmer, you don't need rules. You can just use the heartbeat logging api function.
The fix:
I also added the "cid" if available in the rules UI (There you will see an extra field CID where you can assign the token for).
Heartbeat itself now checks that field as well to see if the comment is published or not. (outer join on {comment} table to check the status field)
so you see, where I can do something general, I'll do it but sometimes it's out of my hands.
Can you verify this new behavior too please?