Skip to Content Skip to Menu

Search Results (Searched for: Triggers:)

  • liaskas
20 Dec 2025 14:44 - 20 Dec 2025 15:00
I have spent the whole week testing without success, and finally i returned back to the very basic!
My goal is to fire a php code after cb subs payments return complete from paypal.

Auto Action
Global
Triggers: onCPayUserStateChange
Type: Code
User: Automatic
Access: Everybody

Conditions:
Condition 1
Custom Value: [var2]
Operator: Equal To
Value: A
Condition 2
Field: Custom > Code
Code:Code:return ( $variables->getCurrentBasket()->gateway_account ?? 0 );Operator: Equal To
Value: 5

Action:
Method: PHP
Code:
Code:
$mailer = \Joomla\CMS\Factory::getMailer(); $mailer->addRecipient('name@domain.com'); //(where info@domain.com is my e-mail) $mailer->setSubject('OSS PHP AUTO ACTION TEST'); $mailer->setBody('If you receive this email, PHP Auto Actions ARE executing.'); $mailer->Send();

The mail is not sent! Is the code wrong or the auto action is not firing? (tested with more that 10 real payments from clients)

What am i doing wrong?
 
  • krileon
18 Dec 2025 17:45
Replied by krileon on topic Email merchandise basket content
Ok, took a bit longer but have a much cleaner solution. Format Functions in CB Auto Actions now support inline Query and Code execution (must be a Super User to toggle on and use these!). This allows substantially easier inserting of the invoice HTML wherever you like in whatever auto action you like. The below for example will example the invoice HTML. Note you'll need to update to latest CB Auto Actions build release before you can utilize this.

Global
Triggers: onCPayAfterPaymentStatusChange
Type: Email
User: Automatic
Access: Everybody
Conditions
Field: Custom > Value
Custom Value: [var4]
Operator: Equal To
Value: Completed
Action
Subject: Invoice
Body:
Code:
[cb:parse function="code"] return $variables['var2']->displayBasket( null, null, 'invoice' ); [/cb:parse]
Parameters
Format Functions: Yes
Format Code Function: Yes

The complicate comes from determining if the basket contains merchandise payments or not. This would apply to all baskets basically. So to find if a merchandise was purchased it'll require an additional condition that checks what is in the basket. The below should work for that.

Field: Code
Custom Code:
Code:
foreach( $variables['var2']->loadPaymentItems() as $item ) { if ( $item->item_type === 'merchandise' ) { return 1; } } return 0;
Operator: Equal To
Value: 1

This should allow the condition to match if the basket contains at least 1 row item that's a merchandise.
  • liaskas
17 Dec 2025 08:29
Here is what we have currently and the auto action is not fired for some reason.

Payment is being finalized and subscription is active.

Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var2]
Operator: Equal To
Value: A
Condition 2
Field: Custom > Code
Code:Code:return ( $variables->getCurrentBasket()->gateway_account ?? 0 );Operator: Equal To
Value: 5

The code in the action tab is the following:

Method: PHP
Code:
Code:
defined('_JEXEC') or die; require_once JPATH_LIBRARIES . '/oss/cbsubs-oss-handler.php'; oss_handle_cbsubs_payment($variables);

Thank you.
  • krileon
16 Dec 2025 14:42
Your conditions are probably is what is failing. The database state is considered in transit. It can change based off webhooks, what state they're moving into/from, etc..

Are you needing to act on the payment status change or the subscription status change? onCPayAfterPaymentStatusChange is the correct trigger for payment status changes and onCPayUserStateChange is the correct trigger for subscription status changes. With both you should be using the variables already provided to them instead of querying for information. After selecting either trigger you should see what variables are available to them just below the Triggers parameter.

Since you mentioned payment being finalized and subscription being active I'd act on subscription state change with onCPayUserStateChange. The below for example should work fine.

Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var2]
Operator: Equal To
Value: A
Condition 2
Field: Custom > Code
Code:
Code:
return ( $variables['var9']->getCurrentBasket()->gateway_account ?? 0 );
Operator: Equal To
Value: YOUR_PAYPAL_GATEWAY_ID_HERE

This will work on renewals as well. If you only want it on first payment you'll need to add a condition against the $reason. Example as follows.

Field: Custom > Value
Custom Value: [var6]
Operator: Not Equal To
Value: R
  • liaskas
16 Dec 2025 11:39 - 16 Dec 2025 12:14
Hello,

We are using CBSubs with PayPal on Joomla 5.4.

We are trying to run post-payment logic (VAT / OSS accounting) using CB Auto Actions, but no Auto Action is firing when PayPal payments are completed.

What we have tested and confirmed:

1. Payments do complete successfully in PayPal

2. Rows are correctly written to: #__cbsubs_payment_baskets (payment_status = 'Completed') and #__cbsubs_payments

We tested the following Auto Action triggers:

onCPayAfterPaymentStatusChange
onCPayUserStateChange

Auto Action PHP code does not execute at all -> verified via error_log

Conditions were reduced to a single SQL condition:

SELECT 1
FROM cbsubs_payment_baskets
WHERE user_id = [var1_id]
  AND payment_status = 'Completed'
  AND gateway_account = <paypal_gateway_id>
ORDER BY id DESC
LIMIT 1


Even with minimal PHP code (just logging), no Auto Action is executed

Our questions:

Are CB Auto Actions expected to fire when PayPal payments are completed asynchronously (IPN / delayed completion)?

Which Auto Action trigger is guaranteed to fire after a PayPal payment is finalized and subscriptions are activated?

Is there an official recommended hook for running post-payment accounting logic (VAT / OSS) in CBSubs?

Thank you.Can you please advise?
Thank you.
  • liaskas
11 Dec 2025 11:23
Replied by liaskas on topic Questions about auto action and gallery
Unfortunately, it stopped working again!

With the following auto action settings, it worked for a while and now...
The images are created in backend CB Gallery: Media
no activity records are created at all in backend CB Activity: Activity.

Auto action settings:

Triggers: gallery_onAfterApproveGalleryItem
Type: CB Activity
User: Automatic
Access: Everybody

Conditions
1
Field:Value
Custom Value: [var3_asset]
Operator: Is REGEX
Value: /^profile\./
2
Field:Value
Custom Value: [var3_asset]
Operator: Is Not REGEX
Value: /\.uploads$/

Action
Mode: Activity
Method: Create
Stream: Profile Activity
Published: 1
Asset: gallery.[var3_type].[var3_id]
Title: empty field
Message: empty field
Owner: [var3_user_id]
Flair: Adult
Cooments: Same as stream
Likes Asset: empty field
Dynamic Group Asset:  empty field
System:  empty field
Date:  empty field
Load By: By Asset Only
Group Asset: gallery.%
 
  • liaskas
08 Dec 2025 19:49 - 08 Dec 2025 20:03
Replied by liaskas on topic Questions about auto action and gallery
The problem is something deeper.

I have set everything in CB Activity > Parameters > Activity

Testing...
  1. User uploaded image. Nothing shows in activity (backend)
  2. Admin approves image.
  3. An activity (backend) a new activity is created with Asset -> "gallery..1" and as an owner it shows the admin. The activity is not published and the flair is in place.
The owner must not be the admin!
The Asset "gallery..1" i do not know where it came from!
The activity must be published.

Auto action settings:

Triggers: gallery_onAfterApproveGalleryItem
Type: CB Activity
User: Automatic
Access: Everybody

Conditions
1
Field:Value
Custom Value: [var1_asset]
Operator: Is REGEX
Value: /^profile\./
2
Field:Value
Custom Value: [var1_asset]
Operator: Is Not REGEX
Value: /\.uploads$/

Action
Mode: Activity
Method: Create
Stream: Profile Activity
Published: empty field
Asset: gallery.[var1_type].[var1_id]
Title: empty field
Message: empty field
Owner: [var1_user_id]
Flair: Adult
Cooments: Same as stream
Likes Asset: empty field
Dynamic Group Asset:  empty field
System:  empty field
Date:  empty field
Load By: By Asset Only
Group Asset: gallery.%

 
  • krileon
05 Dec 2025 16:14
That should be doable since the option selection is stored with the basket, the subscription, and POST data so it's possible to pull that value from either in CB Auto Actions. The main issue will be how you've defaults setup. You'd need to have admin approval enabled by default in CB > Configuration > Registration so that you're turning it off rather than on.

As for what trigger to act on. Probably best to do this the same way CBSubs does. Directly before registration is completed. So the onCPayBeforeUserRegistration trigger should work here. It has limited information in it as follows.
Code:
$_PLUGINS->trigger( 'onCPayBeforeUserRegistration', array( &$chosenPlans, $row ) );

Basically only have the array of plans selected in addition to the user being registered. So this is doable, but it will take PHP experience as you'll be overriding the registration behavior of CBSubs. For example the below will force the registration approved, but needs additional checks like checking the option selection from POST data.

Global
Triggers: onCPayBeforeUserRegistration
Type: Code
User: Automatic
Access: Everybody
Action
Method: PHP
Code:
Code:
global $ueConfig; $ueConfig['reg_admin_approval'] = 0; return true;
Output
Display: return
  • liaskas
28 Nov 2025 17:08
Auto action conditions question was created by liaskas
Hello...

we need an auto action that will redirect guest users to a specific page if the article they try to access is not public.

So far we have...

Global
Triggers: onContentBeforeDisplay
Type: Redirect
User: Automatic
Access: All Non-Registered Users

Conditions
Condition 1: Here we need to set that the redirection is only for articles. Not all content.
Condition 2: Here we need to set that the redirection will happen only to articles that are not public

Action
URL: ARTICLE_URL_HERE

Can you please help me with the conditions?

Thank you in advance.
  • krileon
28 Nov 2025 14:59
Replied by krileon on topic Registration related question.
The only way to conditionally display content like that is with substitutions. You won't be able to do this from CB Content Module because it has no user to act on since they're not logged in.

The best I can suggest is to just replace the confirmation page entirely and redirect them away to language specific pages. That is doable with CB Auto Actions. The below should work.

Global
Triggers: onAfterUserConfirmation
Type: Redirect
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [confirmed]
Operator: Equal To
Value: 1
Condition 2
Field: Custom > Value
Custom Value: [cb_country]
Operator: Equal To
Value: DE
Condition 3
Field: Custom > Value
Custom Value: [cb_gender]
Operator: Equal To
Value: female
Action
URL: YOUR_ARTICLE_URL_HERE

Replace YOUR_ARTICLE_URL_HERE with your language specific article so you can display whatever language specific content you want. I don't know how you're handling age so I didn't add that condition so you'll need to add that yourself.

I suppose another option is to auto login after confirmation. CB Auto Actions includes a system action for this already, but it requires their account to be fully confirmed and approved before it'll auto login. Then you could display whatever you like since they'll be logged in.
  • krileon
26 Nov 2025 21:37
Replied by krileon on topic Registration related question.
Probably the easiest option is to just loop through the user messages and pass them through substitutions so you can just use substitutions in the language override. The below should work.

Global
Triggers: onAfterUserConfirmation
Type: Code
User: Automatic
Access: Everybody
Action
Method: PHP
Code:
Code:
if ( ! $variables['var5'] ) { return; } foreach ( $variables['var5'] as $i => $msg ) { $variables['var5'][$i] = $autoaction->string( $user, $msg ); }
Parameters
Reference Variables: Variable 5

Now all you should need to do is user language overrides and add your substitutions to the confirmation message strings.
  • krileon
26 Sep 2025 14:11
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.
Displaying 16 - 27 out of 27 results.
Powered by Kunena Forum