Skip to Content Skip to Menu

I have difficulties in using the Auto Action Plugin

2 days 12 hours ago - 2 days 12 hours ago #342128 by erichburkhard
Replied by erichburkhard on topic I have difficulties in using the Auto Action Plugin
OK - I understand - you could convince me that it is better that the approval of the avatar images of the invited users is no longer a condition. So the new requirement is to only check if there are 3 invited users who have completed their registration process after they received the invitation link.

For this purpose I have used the trigger called: invites_onAfterAcceptInvite

The test scenario is as follows:

1. User A invites user B (Test10 in my example)
2. User B gets an email in his inbox and clicks on the invitation link and fills out the registration form  on the website
3. 1 A user record for user B will be created in the database and looks like this:

 

3.2 At the same time user B gets a confirmation link in his email box in order to confirm his E-Mail address ... (user B does not yet click on this link)
3.3 The trigger invites_onAfterAcceptInvite fires now

If I do it this way the trigger invites_onAfterAcceptInvite fires before the invited user B (Test10) decided to click on the confirmation email. Problem: There is no guarantee that the invited person B will do this final confirmation step... but this is important because without confirmation user B is not visible in the corresponding userlists

I also didn't find e 'better' trigger which will only fire after the confirmation link of the invited user B has been clicked ? Or is there such a trigger
 
Last edit: 2 days 12 hours ago by erichburkhard.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 49614
  • Thanks: 8488
  • Karma: 1465
2 days 8 hours ago #342131 by krileon
There's a trigger for confirmations. onAfterUserConfirm and onAfterUserConfirmation are both usable. The first one fires for backend and frontend. The second one fires for frontend confirmation link only. So your usage would be something like the below.

Global
Triggers: onAfterUserConfirm
Type: CB Paid Subscriptions
User: Query
Access: All Registered Users
User
Code:
SELECT `user_id` FROM `#__comprofiler_plugin_invites` WHERE `user` = '[user_id]' OR `to` = '[email]' LIMIT 1
Conditions
Field: Custom > Value
Custom Value: [var2]
Operator: Equal To
Value: 1
Field: Custom > Query
Custom Query:
Code:
SELECT COUNT(*) FROM `#__comprofiler_plugin_invites` WHERE `user_id` = '[user_id]' AND `accepted` IS NOT NULL
Operator: Greater Than or Equal To
Value: 3
Action
Mode: Subscribe
Plans: YOUR_PLAN_HERE

This should find the user that invited the user being confirmed and set them into the auto actions user object. Next it checks [var2], which for this trigger is $state (should be noted under Global tab) and is the confirmation state. So it checks that confirmation state is set to 1 for confirmed. Finally we check how many accepted invites the user has (this will be the user that send the invite) by counting them and conditioning against the count. Finally add the subscription to the user who sent the invite.


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