Skip to Content Skip to Menu

Conditions on CB Activity, Trigger: activity_onDisplayStreamActivityNew

  • aybarra
  • aybarra
  • OFFLINE
  • Posts: 17
  • Thanks: 3
  • Karma: 0
2 years 11 months ago #327159 by aybarra
I want to set a condition on a copy of the System Action "CB Activity - Privacy - New". I've tried using several variations of [var1_asset] and [var3_asset] Is REGEX but that failed.

So, in order to test, I created a menu item to a CB Activity with the Action set to Activity and the Asset set to topic. Then setting the Auto Action conditions to check against [var1_asset] or [var3_asset] using operators of Equal To, In, IsRegex, and Empty. All of these failed.

1. A suggestion: the error message from setting Debug to Yes could be more useful if it were to output the value of the variable.
::Action 110 :: Condition 1-1 failed for user 758 with "[var1_asset]" Empty ""
only says the condition failed, but doesn't say what the value of [var1_asset] actually is or that it even exists.

2. I've tried using the Auto Action Output Layout to print values, but that has not been helpful in finding what var1 and var3 actually are. For var2 I get get sample output of:
var2: [var2]
var2_id: 758
var2_username: Bob1

This tells me that the substitutions will only apply for the case when a varX has the suffix of _fieldname. However, blank is produced when outputting [var4] through [var9] suggesting that those variables don't exist.

Can I have a condition on anything in var1 or var3?

3. Is there a way to find out what var1, var2, var3, actually are without having to try and trace though the code or guess at fields to suffix onto the vars?

4. What are var1 and var3 in this case (Trigger = activity_onDisplayStreamActivityNew)?

5. How can I set Auto Action Condition with a Trigger of activity_onDisplayStreamActivityNew for specific Asset values?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48424
  • Thanks: 8274
  • Karma: 1443
2 years 11 months ago #327162 by krileon
activity_onDisplayStreamActivityNew doesn't have an activity object yet. You need to access the asset from the $stream, which is in var3 as shown below.

$_PLUGINS->trigger( 'activity_onDisplayStreamActivityNew', array( &$buttons, $viewer, $stream, $output ) );

Note you can find a list of triggers and their variables in the below tutorial.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18358-using-cb-triggers

Stream objects don't have a asset property though. You need to call the "asset" function of a stream to get its formatted asset. This can be done using the below format function.

[cb:parse function="asset" class="var3" /]

Be sure to toggle "Format Function" below Custom Value or this won't work.


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.

  • aybarra
  • aybarra
  • OFFLINE
  • Posts: 17
  • Thanks: 3
  • Karma: 0
2 years 10 months ago #327170 by aybarra
Thank you for your reply. I think I now understand. The varX variables represent the parameters in the various trigger actions.

Thank you for your explanation of using the format function.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum