Skip to Content Skip to Menu

AutoAction when publishing a new event

  • Toulouzing
  • Toulouzing
  • ONLINE
  • Posts: 167
  • Thanks: 18
  • Karma: 2
2 days 21 hours ago - 2 days 21 hours ago #343445 by Toulouzing
AutoAction when publishing a new event was created by Toulouzing
I am creating an autoaction to send email to group's active users when a new event is created and published

trigger : gj_onAfterCreateEvent
condition : value [var1_published] equal to 1

for the email content, i would like to retrieve the username of group event owner and also the group name . [var1] allows me to get the ID's only and corresponding names are in others tables.  What is the trick to do that in the email content?
Last edit: 2 days 21 hours ago by Toulouzing.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 50216
  • Thanks: 8597
  • Karma: 1470
19 hours 1 minute ago #343448 by krileon
Replied by krileon on topic AutoAction when publishing a new event
CB Auto Actions attempts to automatically find the first valid user object or attempts to build one from discovered user ids. So [name] should already be the group event owners name.

The problem will be getting the group name since all an event contains is the group id and not the name. So you'll need to use format functions for that. Under the Parameters tab enable format functions. Then below that you should see all the available format functions. These will even let you run inline queries or custom PHP. Probably the easiest solution here is to use code since the event does contain a way to get the group object. Below should work.
Code:
[cb:parse function="code"]return $variables['var1']->group()->getString( 'name', '' );[/cb:parse]


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