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!

Linked autoactions

  • activha
  • activha
  • ONLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
4 months 19 hours ago #338708 by activha
Linked autoactions was created by activha
Hi

I'd like  your ideas about linking autoactions.

I have a codeautoaction PHP which gives a result like 
Code:
    return ['result' => 'success', 'user_id' => $user->id, 'name' => '[post_name]', 'actid' => '[post_member]', 'model' => $ndb_model_active , 'url' => $ndb_url_active]; }      else {     return array('result' => 'failed'); }

My code is working fine and I'd like to warn the $user->id that the action was successfully completed by including the 'name' in the message.

Could you tell me how to link a private message to the result ?
Should I set up a new autoaction or just write a php under the result ?
If it's a new autoaction, how can I condition it to the result of the first one and get the userid and the name from the first one ?

thanks for your ideas

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
4 months 19 hours ago #338712 by krileon
Replied by krileon on topic Linked autoactions
I've no idea what this is supposed to be doing. You want to send a PMS when the auto action fires?


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.

  • activha
  • activha
  • ONLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
4 months 18 hours ago - 4 months 18 hours ago #338714 by activha
Replied by activha on topic Linked autoactions
Yes exactly
When it succeed

this is a long php code to add a document to the user’s AI
Last edit: 4 months 18 hours ago by activha.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
3 months 4 weeks ago #338719 by krileon
Replied by krileon on topic Linked autoactions
You can send a PM using the following API so you can just directly do that in your existing code.
Code:
global $_CB_PMS; $_CB_PMS->sendPMSMSG( TO_USER_ID, FROM_USER_ID, PM_SUBJECT, PM_MESSAGE, SYSTEM_PM );

Replace the strings with your relevant information. You can exclude SYSTEM_PM or set it to true to send a system PM, which is normally done for system notifications and probably makes sense here. Example as follows.
Code:
global $_CB_PMS; $_CB_PMS->sendPMSMSG( $user->id, 0, '', 'Your AI processing has completed.', true );


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: activha

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

  • activha
  • activha
  • ONLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
3 months 4 weeks ago #338740 by activha
Replied by activha on topic Linked autoactions
I have a little issue with translations in the code

Tried 
Code:
        $_CB_PMS->sendPMSMSG($user->id, '[post_member]', '', '[cb:translate key="MONIA_MESSAGE_IMAGE_1" default="For info and verification: I just added a photo titled - " /]' .$name. '[cb:translate key="MONIA_MESSAGE_IMAGE_2" default=" - on MoniA\'s image memory. " /]', false);

It works fine but if the language strings include an escaped quote it fails.

For instance it fails with 
Code:
    'MONIA_MESSAGE_IMAGE_1' => 'Pour info et vérification: Je viens d\'ajouter une photo intitulée - ',

but it works with
Code:
    'MONIA_MESSAGE_IMAGE_1' => 'Pour info et vérification: Je viens de rajouter une photo intitulée - ',

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
3 months 4 weeks ago #338743 by krileon
Replied by krileon on topic Linked autoactions
Try using \\' or don't provide a default value and just ensuring you have the string set in the default language plugin. Since you're using PHP you should be able to use CBs language API directly through. Example as follows.
Code:
$translatedString = \CBLib\Language\CBTxt::T( 'MONIA_MESSAGE_IMAGE_1', 'Pour info et vérification: Je viens d\'ajouter une photo intitulée - ' );


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