Below is an example of getting an activity object from an auto action URL.
URL
Code:
index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=ACTION_ID_HERE&activity=ACTIVITY_ID_HERE
Button
Code:
<a href="index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=ACTION_ID_HERE&activity=ACTIVITY_ID_HERE" class="btn btn-primary">Run Auto Action!</a>
Auto Action
Global
Triggers: None
Type: Code
Access: All Registered Users
Conditions
Field: Custom > Value
Custom Value: [cb:parse function="clean" method="int"][get_activity][/cb:parse]
Format Functions: Toggled
Operator: Greater Than
Value: 0
Action
Method: PHP
Code:
Code:
$activity = new \CB\Plugin\Activity\Table\ActivityTable();
$activity->load( (int) '[get_activity]' );
if ( ! $activity->getInt( 'id', 0 ) ) {
return;
}
// Code to do whatever you like with $activity
Output
Display: Redirect
URL: URL_TO_REDIRECT_THEM_BACK_TO_HERE
You don't need the output if you decide to implement this via JavaScript and have it to this with an JS get to the auto action URL. Entirely up to you on implementation details, but that will give you the activity object to work with.