Is there a reference of what var's are used for what?
We've the below trigger documentation that can at least give you an idea what variables are available to a trigger.
www.joomlapolis.com/documentation/279-community-builder/tutorials/18358-using-cb-triggers
Once we've rewrote how we handle triggers we'll be improving our phpdoc for them then be able to parse out that phpdoc into documentation to significantly improve the information available for each trigger, but that won't be for awhile. There's no harm in asking on the forums though as we'd be glad to explain.
How do I find out what to use if I need more cbsubs info?
For that trigger specifically the variables are as follows.
Code:
/**
* Called at each change of user subscription state due to a plan activation or deactivation
*
* @param UserTable $user The user owning the $subscription with that $planId
* @param string $status New status: 'A'=Active, 'X'=Expired, 'C'=Cancelled
* @param int $planId Plan Id which is changing status
* @param int $replacedPlanId Replaced Plan Id in case of an upgrade
* @param ParamsInterface $integrationParams Integration parameters for that plan $planId
* @param string $cause 'PaidSubscription' (first activation only), 'SubscriptionActivated' (renewals, cancellation reversals), 'SubscriptionDeactivated', 'Denied'
* @param string $reason 'N' new subscription, 'R' renewal, 'U'=update )
* @param int $now Unix time
* @param cbpaidSomething $subscription Subscription/Donation/Merchandise record
* @param int $autorenewed 0: not auto-renewing (manually renewed), 1: automatically renewed (if $reason == 'R')
* @return void
*/
public function onCPayUserStateChange( $user, $status, $planId, $replacedPlanId, $integrationParams, $cause, $reason, $now, $subscription, $autorenewed )
So for example var1 is the $user object. To get the users user id from that variable you'd just use [var1_user_id] (but typically you're fine just using [user_id] since that variable is detected as the User for that auto action).