Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Black Friday Intro Offer for your subscription's lifetime
🎉 Black Friday sale is here! Great savings on professional and developer memberships! Get 25% off now with code BLACK-FRIDAY-2024!

[#7028] CB Auto Actions send email notification on article submission?

7 years 1 month ago - 6 years 9 months ago #297809 by independentCog
Is this possible with auto actions?
I'm working to come up with a way so that certain users are sent an email once an article has been submitted to a specific category.
Example:
Author submits an article to category 1 > Publisher 1 gets an email
Author submits an article to category 2 > Publisher 2 gets an email
Last edit: 6 years 9 months ago by krileon. Reason: Added [#7028] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
7 years 1 month ago #297811 by krileon
With CB Auto Actions 7.0.0 you can now act on Joomla events. So yes this is possible now. Prefix Joomla events with "joomla_" when supplying your triggers. See the below for Joomla content events.

docs.joomla.org/Plugin/Events/Content

In your case for example you'd supply a trigger of joomla_onContentAfterSave, which has content, article, and isNew variables. You can access the article object with [var2] so for example [var2_catid] would be the category id. Joomla events tend to be wide reaching though so you probably will want to condition the content variable to make sure it's an actual article. The below condition would probably work.

[var1] Equal To com_content.article


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.

7 years 1 month ago #297819 by independentCog
Can't seem to get this to work so I tested around.

I created an auto actions that sends an email when someone logs in.

type: email
trigger: joomla_onUserLogin
condition: empty
action: test email to one of my personal one

Email sends without issue. Did this to check if it was the mailer for some reason.

When switching out the trigger to joomla_onContentAfterSave or joomla_onContentChangeState (used this just to test another one)

The email does not send. Is there any reason possibly that conditions are mandatory for some of these triggers?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
7 years 1 month ago #297825 by krileon

Is there any reason possibly that conditions are mandatory for some of these triggers?

You need to condition the context because Joomla content triggers are not limited to Joomla articles. They're used in a lot of other locations. Enable debug mode and maximum error reporting in Joomla global configuration then in your auto action enable Debug under the Parameters tab to output an errors so you can see why the auto action is failing. Beyond that I can not advise you on using Joomla events and you'll need to refer to Joomla documentation regarding them.


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.

6 years 10 months ago - 6 years 10 months ago #301388 by independentCog
Coming back to this after some time.
I would definitely appreciate help on this as this would be a really nice functionality to add to my site.

Below I've attached images out how I set the condition field. I'm likely missing something simple here and clarification will go a long way into helping me understand how the works.
Attachments:
Last edit: 6 years 10 months ago by independentCog.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
6 years 10 months ago - 6 years 10 months ago #301395 by krileon
See my above reply regarding debugging an auto action. It's probably failing on your [article_id] substitution, because that substitution doesn't exist. Same applies to [context]. You can't access trigger variables by their variable names as CB Auto Actions has no way of knowing these. You have to access them using var1-15 (e.g. [var1_id]). For example if using joomla_onContentAfterSave then its variables are as follows.

Code:
/** * @param string $context The context of the content passed to the plugin (added in 1.6) * @param object $article A JTableContent object * @param bool $isNew If the content has just been created */ public function onContentAfterSave( $context, $article, $isNew )

With the above you'd change [article_id] to [var2_id] and [context] to [var1].


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: 6 years 10 months ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum