Skip to Content Skip to Menu

CB Activity Bot plugin problem

  • kdave321
  • kdave321
  • ONLINE
  • Posts: 196
  • Thanks: 25
  • Karma: 2
1 day 11 hours ago #339829 by kdave321
CB Activity Bot plugin problem was created by kdave321
I have added the cbactivity content plugin to multiple kinds of pages and it was working fine until the recent major version update.

One page type was JEvents Event pages. The only way to make the comments unique to the event was to change the ArticleId (now ContentId) to a combination of ev_id and repeat_id because all events can be repeats.  I had to change plugins/content/cbactivitybot/cbactivitybot.php to handle a string instead of integer.

I had to make some changes for the major version update to still work but I could correctly display previously stored comments. But now the unique asset string was being ignored when storing comments.

It has taken me days to dig thru what was happening where, and I found a fix that works for me.  I knew this unique asset string would have to be stored in form's action, and indeed, I see you are storing an encoded version of the correct string - but you are not ever using it!

In plug_cbactivity/library/Controller/CommentsController.php function save() , I added:
$asset                                                          =       StringHelper::decodeString( $this->input->getString( 'asset', '' ) );
and then used that $asset in $row->setAsset() ( if it exists) . I hoping that has not messed up comments within CB itself.

Hope this helps anyone with similar problems.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48609
  • Thanks: 8300
  • Karma: 1446
1 day 2 hours ago - 1 day 2 hours ago #339830 by krileon
Replied by krileon on topic CB Activity Bot plugin problem
Lets try to address what the real problem is here. By default CB Activity Bot is using the Articles comment stream in CB Activity > Streams > Comments. This will generate comments with a "article.[article_id]" asset and is expected usage.

Within System > Manage > Plugins edit "Content - CB Activity" then under Comments set Stream to "Content". This changes to a stream that uses "[content_context].[content_id]" for the asset, which will be pulled from whatever the 3rd party extension sends as context and object id to onContentAfterDisplay. That should be more agreeable with 3rd party extensions.

You can effectively do the same for likes under the Likes tab set Asset to [content_context].[content_id] for the same result for likes.

Your modification is going to break things and allows anyone to store with whatever asset they want thereby creating a serious security problem. Do not make that change.

Should you need to render comments more specifically in JEvents I highly recommend using the Include/Exclude features under the Comments and Likes tab to exclude JEvents. Then use CB Auto Actions to render the stream so you can more specifically pass data to the streams asset construction. I can provide an example of this if you can provide what data JEvents is sending to the onContentAfterDisplay event.


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: 1 day 2 hours ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48609
  • Thanks: 8300
  • Karma: 1446
1 day 1 hour ago #339831 by krileon
Replied by krileon on topic CB Activity Bot plugin problem
I don't know what context JEvents is sending to onContentAfterDisplay, but went ahead and made an example for you to render a comment stream using CB Auto Actions in JEvents more specifically. This also lets you even make your own comment stream exclusively for JEvents if you wanted so you can customize what features are available as well.

Global
Triggers: onContentAfterDisplay
Type: CB Activity
User: Self
Access: Everybody
Conditions
Field: Custom > Value
Custom Value: [var1]
Operator: Equal To
Value: com_jevents.event
Action
Mode: Stream
Type: Comments
Stream: Content
Data 1
Key: content_context
Value: [var1]
Data 2
Key: content_id
Value: [var2_repeat_id]
Output
Display: return

In this example I'm using a context of com_jevents.event, but you may need check to be sure that's correct, and am using the Content stream and settings its substitutions via the data parameter.

Next in System > Manage > Plugins edit "Content - CB Activity" then under Comments set Stream back to "Article" and then under Comments and Likes set "Exclude Context" to com_jevents.event to exclude JEvents. Again, the context may not be correct so you'll need to check with JEvents to see what context they're using.


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.

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

Moderators: beatnantkrileon
Powered by Kunena Forum