Skip to Content Skip to Menu

GroupJive Auto Action Variables not available

  • XBOOMX
  • XBOOMX
  • OFFLINE
  • Posts: 150
  • Thanks: 15
  • Karma: 1
1 day 22 hours ago #343928 by XBOOMX
Hello,I am currently trying to integrate Community Builder GroupJive with UserPoints using CB Auto Actions.The goal is:
  • User joins a GroupJive group
  • CB Auto Action trigger fires (
    Code:
    gj_onAfterJoinGroup
    )
  • UserPoints awards points automatically
This already works in general.The problem is:
Inside the Auto Action, the trigger variables are empty.I tested the following trigger:
Code:
gj_onAfterJoinGroup
According to the variable list, the trigger should provide:
  • var1 = $row
  • var2 = $group
  • var3 = $user
However, inside the PHP code action:
Code:
var1 type: not set var2 type: not set var3 type: not set
Only the currently logged-in Joomla user can be accessed via:
Code:
\Joomla\CMS\Factory::getApplication()->getIdentity()
Because of this, I currently cannot access:
  • the GroupJive group ID
  • the group name
  • the joining user object from the trigger itself
This means I cannot build a proper “1 user + 1 group = 1 reward” system using a unique keyreference.My question:How can I correctly access the GroupJive group object or group ID inside a CB Auto Action using the
Code:
gj_onAfterJoinGroup
trigger?Is there a different syntax required for:
  • Code:
    $var1
  • Code:
    $var2
  • Code:
    $var3
or are these variables unavailable in Auto Actions PHP code?Any help or example would be greatly appreciated.Thank you very much.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 50443
  • Thanks: 8629
  • Karma: 1472
1 day 17 hours ago #343944 by krileon
Replied by krileon on topic GroupJive Auto Action Variables not available
You can access the variables 2 different ways inside Code actions. One is the standard substitution format. The other is using $variables. Examples for both as follows. I'll use the variables for that trigger in the examples.

Substitutions:
Code:
$userId = (int) '[var1_user_id]';

$variables:
Code:
$userId = $variables['var1']->user_id;

Both should give you the user id of the user joining the group. Their full CB user object is in var3 if you need more than their id though.


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.
The following user(s) said Thank You: XBOOMX

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

  • XBOOMX
  • XBOOMX
  • OFFLINE
  • Posts: 150
  • Thanks: 15
  • Karma: 1
1 day 6 hours ago #343953 by XBOOMX
That was the crucial clue. Thank you very much.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum