Ok, the below should be able to do that. It'll interrupt the join process if they've already joined a group in a specific category.
Global
Triggers: gj_onBeforeJoinGroup
Type: Code
User: Automatic
Access: Everybody
Conditions
Field: Custom > Query
Query:
Code:
SELECT u.`id`
FROM `#__groupjive_users` AS u
INNER JOIN `#__groupjive_groups` AS g
ON g.`id` = u.`group`
INNER JOIN `#__groupjive_categories` AS c
ON c.`id` = g.`category`
WHERE u.`user_id` = '[user_id]'
AND c.`id` = CATEGORY_ID_HERE
Operator: Not Empty
Action
Method: PHP
Code:
Code:
$variables['var1']->setError( 'You have already joined a group in this category.' );
Replace CATEGORY_ID_HERE in the query condition with the category you want to check against. You can adjust the error message to whatever you'd like it to say. There isn't a way to suppress the display of the join button though. Can consider adding a way of doing that to GJ if necessary.