Which is fired first? Welcome email or trigger?

12 years 8 months ago - 12 years 8 months ago #174081 by apdt
I need rather urgent help.

1. Membership is set to require admin approval.
2. I'm using CB Queries plugin, onAfterUserApproval trigger to populate a CB field.
3. I want to show this CB field in the Welcome Email after admin approve the registration (CB > Configuration > Registration > Welcome Email)

However, the CB field in the email is blank which I assume because the Welcome Email is sent before CB Queries is executed. Can anyone confirm if this is true?

I'm using CB 1.4

EDIT:
I tested again by creating an email using CB Emails and onAfterUserApproval trigger, display the CB field [cb_memberid] and the field is blank in the email that I receive. So how can I display this field in the email?

Please Log in to join the conversation.

12 years 8 months ago - 12 years 8 months ago #174115 by krileon
The welcome email sends before the trigger. You need to use the trigger onBeforeUserApproval so the data is up to date before the email 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 to join the conversation.

12 years 8 months ago - 12 years 8 months ago #174171 by apdt
Nope, it still doesn't work :(

Are my 'User' and 'Access' settings correct (pls see the attached screenshot)? Here is what I have in the Welcome Email config:
Welcome [NAME],

Your membership application has been approved.

Your Membership Number: [USERNAME]


You can visit our website and login to members area at [SITEURL] using the following details:

[DETAILS]

And here is what I receive:
Welcome John Doe,

Your membership application has been approved.

APDT Membership Number: John Doe


You can visit our website and login to members area at http://www.mydomain.com using the following details:

Email : johndoe@example.com
Username : John Doe
Password : 7sjq840jk

When I check the User Management, the username is correctly changed to numeric member number so the query is definitely executed but it seems onBeforeUserApproval also fires before the welcome email is sent.
Attachments:

Please Log in to join the conversation.

12 years 8 months ago #174194 by krileon
That's not the Welcome email. That's the Pending email, which is fired well before the Approval trigger and Welcome email. The welcome email can be delayed. The Pending email is always sent immediately after registration. Please try using the triggers onAfterUserRegistration (frontend) and onAfterNewUser (backend). Should always be done immediately after registration especially given you're restructuring the username.


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.

12 years 8 months ago #174199 by apdt
Can you clarify which one did you mean the Pending email? The email content I gave you in the original post comes from the outlined box as seen on the screenshot attached. Am I correct that this is the Welcome email? Pending email is the one above it and I have no problem with that.

I can't use onAfterUserRegistration/onAfterNewUser because the membership number should only be generated if the member is approved as otherwise we will 'waste' the numbers on people whose membership requests are rejected.

So the welcome email is sent even before onBeforeUserApproval trigger?
Attachments:

Please Log in to join the conversation.

12 years 8 months ago - 12 years 8 months ago #174223 by krileon
The onBeforeUserApproval is the appropriate trigger and it is fired before the email. It's likely your conditional or your query is failing all together and the trigger isn't the problem as you have the correct trigger. Please test your query without the Conditional then also test a more basic query as well as test queries in database directly with test date to confirm they work.

You're welcome to also try onUserActive or onBeforeUserActive triggers, but they fire directly inside the activation function and directly before the emails send which this could cause it to trigger on welcome and pending emails alike. This is simply a trial and error process. Please see tutorials within my signature regarding "event triggers" for available triggers.


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.307 seconds

Facebook Twitter LinkedIn