Use triggers to send email

13 years 4 months ago #147475 by Ducatiklubben
Use triggers to send email was created by Ducatiklubben
We are using cbsubs SQL action to update username when user activates the subscription. We want to send the activation email after this has been executed.
when a user does the registration cbsubs will automatically create an account and user is logged in while doing the payment. When payment is done, a mail is being send out and then the SQL action takes place. This results in that the welcome email will display the wrong username. It will show joomla default ("first name last name") and not the username updated by SQL action.

We have tried to use cbemail plugin and trigger the email on the event onBeforeFirstLogin but that doesn't seem to work. I guess because user already login the first time, when user did the registration.

We have been looking for a trigger to use to solve this, like a onAfterUsernameChange... Anyone have an ide to send the welcome email one second or more after user has been activated so the welcome email gets right?

Please Log in to join the conversation.

13 years 4 months ago #147570 by krileon
Replied by krileon on topic Re:Use triggers to send email
Best I can suggest is using CBSubs Emails integration and sending an email after plan activation. This should put it in time with the SQL update so they get the correct information. Please keep in mind plugin order in Plugin Management is VERY important, because it's also the execution order. Ensure CBSubs SQL actions is ordered BEFORE CBSubs Emails.


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 to join the conversation.

13 years 4 months ago #147932 by Ducatiklubben
Replied by Ducatiklubben on topic Re:Use triggers to send email
I have installed cbsubs email plugin and verified that it is last in the list of plugins, still the username is wrong when the email is being send.

I was thinking if I can use the URL plugin and have a php script sending the email... Do you think that possible or will I get the same result perhaps?

We have upgraded to cb 1.3 and cbsubs 1.1. Are there any new triggers introduced that we can use? Similar to afterSubscriptionActivation

Please Log in to join the conversation.

13 years 4 months ago #148008 by krileon
Replied by krileon on topic Re:Use triggers to send email

I have installed cbsubs email plugin and verified that it is last in the list of plugins, still the username is wrong when the email is being send.

Hmm, that doesn't seam right. If SQL Actions is fired before Emails integration then the email should contain the new value. It's very likely that the user object is not being updated as the SQL Actions is a direct database query which is why the substitution wouldn't be up to date yet. CBSubs Fields does update the user object, but you can't use complex queries or anything as the values.

I was thinking if I can use the URL plugin and have a php script sending the email... Do you think that possible or will I get the same result perhaps?

Possibly; it's certainly worth a shot.

We have upgraded to cb 1.3 and cbsubs 1.1. Are there any new triggers introduced that we can use? Similar to afterSubscriptionActivation

No, CBSubs triggers are not yet available for public 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 to join the conversation.

13 years 4 months ago #148014 by Ducatiklubben
Replied by Ducatiklubben on topic Re:Use triggers to send email
Is there any way of delaying the email so that the mail is being send like a minute after activation has been done, so that SQL action have the time to update?

Was thinking about the URL plugin, aren't you suppose do send the input values to the php script together with the URL? Wouldn't this mean that the old username will be in the URL since SQL action have not had the time to update it?

Please Log in to join the conversation.

13 years 4 months ago #148110 by krileon
Replied by krileon on topic Re:Use triggers to send email

Is there any way of delaying the email so that the mail is being send like a minute after activation has been done, so that SQL action have the time to update?

No, sorry. We do have plans to implement the ability to delay events such as sending emails in a future release, but requires major API additions to CB. Something probably for CB 2.0 or later.

Was thinking about the URL plugin, aren't you suppose do send the input values to the php script together with the URL? Wouldn't this mean that the old username will be in the URL since SQL action have not had the time to update it?

Correct, you send to CBSubs URL a substitution via URL, post variable, etc.. so you'd have the same results. What you could do is send the user_id to your script file then query the _users database table with the user_id for the new username, this would give you the desired results IF the username is actually being updated.


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.261 seconds

Facebook Twitter LinkedIn