Skip to Content Skip to Menu

[SOLVED] Trigger for action when cliking a field who contains a link

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
6 years 8 months ago - 6 years 8 months ago #301794 by chanteur94
Hi

I'm still not specialize in Auto_Action but i know that is a powerful tools.

I would like, for my exemple, sending an email to admin when a user clic on a field who contains a File.
My action would be MAIL (courriel in french), but witch trigger do I use to specify the name of the field who contains the file ?

Maybe it's not possible.

Thank you.
Last edit: 6 years 8 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 8 months ago #301808 by krileon
There's no trigger when someone clicks a field. The generic field class trigger is fired when someone attempts to download or view a file from a file field though and you maybe able to use that, but it's a bit of a long shot. Example as follows.

Global
Trigger: onAfterfieldClass
Type: Email
User: Automatic
Access: Everybody
Conditions
1: [var2_id] Greater Than 0
2: [var3] Is Not REGEX /profile|edit|list/
3: [get_function] Equal To download

That should match the condition checks for the field class behavior of a field field. The rest of the email action you can configure as normally. The user substitutions will be of the profile owner though and not the viewing user unless you set User to Self.


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.

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
6 years 8 months ago #301832 by chanteur94
Using [var] is still not easy for me.

So, for the moment I tried Auto-action with simply :
Global
Trigger: onAfterfieldClass
Type: Email
User: Automatic
Access: Everybody

No conditions
When I download a file in my website I don't received Mail.

I tried also to put Condition :
[get_function] Equal To download

No email also.


Normaly, without conditions I should receive an email everytime I download a file on my website, no ?

PS :
I have another Auto Action Email with trigger OnAfterUserLoginSuccess who works.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 8 months ago #301837 by krileon

Using [var] is still not easy for me.

You don't need to do anything to the var usages beyond use exactly as provided in my example.

When I download a file in my website I don't received Mail.

The file field does an exit so the after trigger may not work. Try the below usage instead.

Global
Trigger: onBeforefieldClass
Type: Email
User: Automatic
Access: Everybody
Conditions
1: [var2_id] Greater Than 0
2: [var3] Is Not REGEX /profile|edit|list/
3: [get_function] Equal To download


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

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

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
6 years 8 months ago - 6 years 8 months ago #301846 by chanteur94
Thank you Kyle. It works now.

I have now to try to find solution for conditionnal what file is downloaded.

Another question -> I answer to myself
When I display with substitution the field file i obtain :

The link of the file : www.mywebsite.com/cb-profile/fieldclass?field=cb_notedoperation&function=download&user=411&reason=profile with the [FIELD_NAME]


The name of the file with the [cb:userfield field="FIELD_NAME" /]
Thank you.
Last edit: 6 years 8 months ago by chanteur94.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 8 months ago #301859 by krileon
You can also get the filename by accessing the user object variable for that trigger, which is var2. So [var2_FIELD_NAME] should just be the filename as stored in the database.


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