Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 25th)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

CB Gallery autoaction to create an item

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
8 months 2 days ago #337919 by krileon
Replied by krileon on topic CB Gallery autoaction to create an item
The asset should be a gallery asset. So that would normally just be gallery.MEDIA_TYPE.MEDIA_ID. You should be able to just make a copy of the CB Gallery comment stream included with CB Activity then make whatever changes you need for that specific media then I assume you're using CB Auto Actions to insert that comment stream specifically for that media and in that auto action you'd add your conditions to check for profile owner and viewer user id against the asset of the media.


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
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
4 months 2 days ago #338989 by activha
Replied by activha on topic CB Gallery autoaction to create an item
I have a final question on this topic.
Using these triggers :
gallery_onAfterUpdateItem
gallery_onAfterCreateItem

My code runs very well, but I have noticed that when an item is edited through the frontend it seems like these triggers are not called. Is it normal ?
I mean that if I change the file they seem to trigger, but if I only change the name of the file or the privacy settings, nothing happens.

What triggers could I use to cover all scenarios ? 

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
4 months 1 day ago #338990 by krileon
Replied by krileon on topic CB Gallery autoaction to create an item
gallery_onAfterUpdateItem would be called during edits assuming the edit save was successful. If it was interrupted for any reason then only the onBefore would fire.


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
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
4 months 1 day ago - 4 months 1 day ago #338992 by activha
Replied by activha on topic CB Gallery autoaction to create an item
Answer found :-)
Last edit: 4 months 1 day ago by activha.

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

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
3 months 3 weeks ago - 3 months 3 weeks ago #339038 by activha
Replied by activha on topic CB Gallery autoaction to create an item
I have one last question on this subject.

Is it possible to condition these triggers to not fire when it's only a change of folder for the item ? or should I code it in my php ?
Last edit: 3 months 3 weeks ago by activha.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
3 months 3 weeks ago #339039 by krileon
Replied by krileon on topic CB Gallery autoaction to create an item
For gallery_onAfterUpdateItem, yes. var1 is the updated gallery object and var2 is the previous gallery object. You can use that to compare the two objects to see exactly what changed. Example as follows.

Field: Custom > Value
Custom Value: [var1_folder]
Operator: Equal To
Value: [var2_folder]

That should require the folder to not have changed. If you have the same auto action also acting on gallery_onAfterCreateItem you'll probably need to take that into account or separate the two auto actions since var2 doesn't exist for gallery_onAfterCreateItem. You could probably IF condition it though. The below I believe should work.

Value: [cb:if trigger="gallery_onAfterCreateItem"][var1_folder][cb:else][var2_folder][/cb:else][/cb:if]

That should cause it to just compare var1 to var1 if it's the gallery_onAfterCreateItem trigger otherwise will compare to var2.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum