Skip to Content Skip to Menu

[SOLVED] show article comments in activity stream

7 years 4 months ago - 7 years 4 months ago #294803 by schrammelmann
Hi!

I am fighting with commenting on Joomla articles. The commenting itself works (via CB Activity Content Bot).

But how do I make it that the comments are displayed in my menu item "Recent Activity", just like the photos from the gallery. Here it works out of the box.

I've tried many things with AutoActions, but I have not managed to display a link to the commented article or even the comment itself in the activities.
I was experimenting with an action to create activity with trigger onAfterCreateComment and onAfterUpdateComment. I used the condition [var1_asset] is REGEX /^article./
How can I find out which variables (for example, [var1_user_id], [var1_date], etc.) are available for the action? Is there a variable for the comment content and the article URL?

It would be nice to can write comments (like in the gallery) in the Activety Stream, as well as on the article itself and in both views (article and activity stream) the same comments will be displayed.

Is this possible and if so which Auto Actions do I have to create?
What is the meaning/sense of Auto Action mode=stream?

I noticed something else. I use the Joomla articles for CB blogs.
When creating a blog the context is set to blog.[article_id]. If I comment the article then context of comment is set to article.[article_id].

Thanks a lot in advance to hints and tips.

Regards, Michael
Attachments:
Last edit: 7 years 4 months ago by schrammelmann.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48448
  • Thanks: 8280
  • Karma: 1443
7 years 4 months ago #294821 by krileon
Replied by krileon on topic show article comments in activity stream
There is no activity for commenting on an article. You'd need to create an auto action to generate such activity. See the existing system actions for generating activity for various content for examples. There is also no activity parsing for Joomla content except in the case of CB Blogs, but the core activity template file can be extended as needed to support parsing Joomla content and without such parsing the comments for your activity will likely be linked to the activity as you'd need to change the comment asset for that activity entry.

When creating a blog the context is set to blog.[article_id]. If I comment the article then context of comment is set to article.[article_id].

That's because the commenting is on a Joomla article. It has no idea that's a blog.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: schrammelmann

Please Log in or Create an account to join the conversation.

7 years 4 months ago - 7 years 4 months ago #294840 by schrammelmann
Replied by schrammelmann on topic show article comments in activity stream

krileon wrote: ... but the core activity template file can be extended as needed to support parsing Joomla content ...


Thank you, this was a very good tip. I have duplicated the showBlog function there and renamed it to showArticle.

Then I substituted the preg_match in the parseCore Function from "blog" to "article" and only adapted the language code for the message in the new showArticle function from "published a new blog entry" to "has comment an article". Then I created a language override for the new message string (german).

Also, I created an Auto Action, which creates an activity for comments on articles. The asset for activity and comments is artcile.[article_id].

Now I am very close to it. See screenshots.

What is not working yet is that when I enter a comment on the activities, at first it is visible, but after a page reload, it disappears.
On the article side all comments will be shown correct.

It seems as if somewhere is a further filter, which prevents the comments with the asset article.[article_id] are displayed in the activity stream or at least they can't match properly.
Last edit: 7 years 4 months ago by schrammelmann.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48448
  • Thanks: 8280
  • Karma: 1443
7 years 4 months ago - 7 years 4 months ago #294853 by krileon
Replied by krileon on topic show article comments in activity stream
The only thing linking comments to an activity entry is the asset for the comments stream output in that activity entry. If the comments from your article are not showing in the activity entry then the comments asset for that activity entry is not correct. Review the existing core activity parsing in the below file carefully as comments asset is adjusted for several activity entries to point to their appropriate content.

components/com_comprofiler/plugin/user/plug_cbactivity/templates/default/activity_core.php

In your case you likely need to be using the below.

Code:
$row->params()->set( 'overrides.comments_asset', 'asset' );

This means the comments will use the same asset as the activity entry. Your activity entry should have an asset of "article.ARTICLE_ID" (verify this is the case within CB Activity > Activity backend management). I've also added a feature ticket to implement parsing of article.ARTICLE_ID activity as core activity.

forge.joomlapolis.com/issues/6670


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 7 years 4 months ago by krileon.
The following user(s) said Thank You: schrammelmann

Please Log in or Create an account to join the conversation.

7 years 4 months ago #294875 by schrammelmann
Replied by schrammelmann on topic show article comments in activity stream
Hello krileon, thanks for the feature ticket!

I'm afraid to waste your time, but I do not get that. Maybe I do not understand your hints, but maybe something is funny.

The asset of activity and comment is the same -> article.ARTICLE_ID.

Curiously, I get exactly what I want when I create a dummy comment with the asset activity.ACTIVITY_ID.
This comment is nowhere displayed, but when exists the others where shown in activity view and article view.
As soon as I delete the dummy comment, the real comments are only displayed in the article view, no longer in the activity stream.

Hmm?
Attachments:

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48448
  • Thanks: 8280
  • Karma: 1443
7 years 4 months ago #294881 by krileon
Replied by krileon on topic show article comments in activity stream
The below should generate an activity entry when you comment on an article.

Global
Triggers: activity_onAfterCreateStreamComment, activity_onAfterUpdateStreamComment
Type: CB Activity
User: Automatic
Access: Everybody
Conditions
1: [var3_asset] Is REGEX /^article./
Action
Mode: Activity
Method: Create
Asset: [var3_asset]
Owner: [var3_user_id]
Date: [var3_date]
Load: By Asset Only

This is basically mimicing the comment activity on activity entries, but instead checking that the comment is on an article. Again, there is no parsing for this type of activity in CB Activity though. So you'd have to add that to the below template file or wait for this functionality to eventually be implemented.

components/com_comprofiler/plugin/user/plug_cbactivity/templates/default/activity_core.php


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: schrammelmann

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum