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!

Autoaction id

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 month 2 weeks ago #339553 by activha
Autoaction id was created by activha
Hello

I would like to condition an external php code to an action id in order to adapt the variables with the triggers used without having to duplicate the code.

1) how could I get the autoaction id ?
I tried $action->id but it does not seem to work

2) when using my autoaction, how can I output a system info message upon completion when editing a field by ajax ?


Thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
1 month 1 week ago #339558 by krileon
Replied by krileon on topic Autoaction id

1) how could I get the autoaction id ?
I tried $action->id but it does not seem to work

I assume you're including your PHP file in a Code action with Method of PHP? If so you access the auto action with $autoaction. So to get the id you'd use $autoaction->id or the getter function $autoaction->getId(). $action gives you the action itself, which is a different object and is the processing of an auto action.

2) when using my autoaction, how can I output a system info message upon completion when editing a field by ajax ?

Joomla system messages do not output during ajax exists. Generally you'd just echo whatever text/HTML you want displayed, but will depend on what trigger you're trying to use.


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
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 month 1 week ago #339563 by activha
Replied by activha on topic Autoaction id
I am using a website field with onAfterUserUpdate 
The idea is to trigger the php code when the field has been changed or updated by ajax, then display a success message once the code is finished with a return.

I need the autoaction id to use and already existing code and adapt it depending on the trigger and the variables used.
Ideally as explained in my other thread  www.joomlapolis.com/forum/developer-members-support/247125-cb-gallery-extended-use that would be best to deal with these kind of links as media assets but as CB Gallery cannot do it, I'll step back to website fields.

Pity though, because it's really websites assets as media that needs to be displayed in the same area as CB Gallery items. For instance it can be up to 10 websites that need to be displayed in an album with files and videos on the same subject. That's kind of the same thing as displaying outside videos or outside files linked ;-)

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
1 month 1 week ago #339566 by krileon
Replied by krileon on topic Autoaction id

I am using a website field with onAfterUserUpdate
The idea is to trigger the php code when the field has been changed or updated by ajax, then display a success message once the code is finished with a return.

There's no real support for that. Best I can suggest is just trying echoing out a message. The ajax edit display is meant to just mimic normal profile edit and profile view so the message would ideally need to extend either of those instead of on onAfterUserUpdate.

I need the autoaction id to use and already existing code and adapt it depending on the trigger and the variables used.

You shouldn't have any issues accessing the auto action id from PHP with either of the following.

Direct
Code:
$autoaction->id
Getter
Code:
$autoaction->getId()
Substitution
Code:
[action_id]

Pity though, because it's really websites assets as media that needs to be displayed in the same area as CB Gallery items. For instance it can be up to 10 websites that need to be displayed in an album with files and videos on the same subject. That's kind of the same thing as displaying outside videos or outside files linked ;-)

It's outside the scope of CB Gallery. I actually completely regret even implementing support for linked external media, but it's too late to undo that. Sharing websites is really something CB Activity should be used for as it has everything it needs to properly parse a URLs metadata and display it.


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
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 month 1 week ago #339572 by activha
Replied by activha on topic Autoaction id

The ajax edit display is meant to just mimic normal profile edit and profile view so the message would ideally need to extend either of those instead of on onAfterUserUpdate.

What trigger would you suggest to act both on the field change and the ajax display ? onAfterUserProfileSaved ?

Sharing websites is really something CB Activity should be used for as it has everything it needs to properly parse a URLs metadata and display it.

Yes but how could I set a private activity display set for specific users and visible only to them and their connections, so that these users would be able to manage a list of their preferred websites/links just as if it was media assets ? CB Gallery mechanism seemed really good for this kind of use and display.

The idea was that these users would be able to manage, edit, add or remove a list of websites easily, and then I could set my code autoaction on each item of this list.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
1 month 1 week ago - 1 month 1 week ago #339574 by krileon
Replied by krileon on topic Autoaction id

What trigger would you suggest to act both on the field change and the ajax display ? onAfterUserProfileSaved ?

I would probably completely separate the two logics. Handle whatever saving behavior you need on onAfterUserUpdate then display logic on onAftergetFieldRow. When acting on onAftergetFieldRow check if [get_function] is "ajax_save" and that will let you know it's an ajax edit.

Yes but how could I set a private activity display set for specific users and visible only to them and their connections, so that these users would be able to manage a list of their preferred websites/links just as if it was media assets ? CB Gallery mechanism seemed really good for this kind of use and display.

That's easily doable. Create a Activity field in CB > Field Management then use CB Privacy or CB Conditional to restrict access to the field (e.g. only connections and profile owner can see it). If you want to customize what features that stream has edit the Profile Field stream in CB Activity > Streams > Activity or create a new stream with a field specific asset of profile.[user_id].field.[field_id] then customize all of its settings and select that stream in your activity field. Under Create be sure to set Create Access to Owner Only as well so only the profile owner can make posts.

Now if you don't want those posts showing in Recent Activity or Profile Activity simply edit those streams on that same CB Activity > Streams > Activity page and under Filters use the Exclude feature to exclude that stream using the Exclude > Streams parameter.

Additionally comment streams also support link parsing so you optionally can just use a comment stream to remove needing to exclude anything, but has less features than activity streams so will just kind of depend on what you're wanting here.

The idea was that these users would be able to manage, edit, add or remove a list of websites easily, and then I could set my code autoaction on each item of this list.

I would just use CB Field Groups with a web address field then. You'd just act on normal profile update triggers and can itinerate through the JSON structure of the field group field and do whatever you like with that data.


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: 1 month 1 week ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum