Easily done using SQL Actions. The majority of the plugins can be or are done with just queries. We used integration plugins to make it simple. However, for in-depth usage of a component I would suggest using queries. Yes, you can do this for groupjive with a query as SQL Actions supports substitutions.
Here are example queries, both will need to be ran. One creates the group. The other inserts the user into the group.
[code:1]
INSERT INTO `#__gj_groups` ( `name`, `descr`, `date_s`, `type`, `creator`, `user_id`, `active`, `category` ) VALUES ( 'My Group', 'My Group Description', NOW(), 1, '[username]', [user_id], 1, [cb_gjcategoryID] );
INSERT INTO `#__gj_users` ( `id_user`, `id_group`, `date`, `status` ) VALUES ( [user_id], '', NOW(), 'active' );
[/code:1]
Complex SQL is going to be needed to grab some IDs. Such as groupid and categoryid. Using a standard drop-down field from field management will not return a categories ID, but its name instead. So you need to do a select query inside the insert query to grab the ID.
Example:
[code:1]
INSERT INTO `#__gj_groups` ( `name`, `descr`, `date_s`, `type`, `creator`, `user_id`, `active`, `category` ) VALUES ( 'My Group - [user_id]', 'My Group Description', NOW(), 1, '[username]', [user_id], 1, ( SELECT `id` FROM `#__gj_grcategory` WHERE `catname` = '[cb_gjcategory]' ) );
INSERT INTO `#__gj_users` ( `id_user`, `id_group`, `date`, `status` ) VALUES ( [user_id], ( SELECT `id` FROM `#__gj_groups` WHERE `name` = 'My Group - [user_id]' ), NOW(), 'active' );
[/code:1]
As you can see I've done a select within an insert to get category ID and groupid. I've also changed the group name to be unique in order to grab its ID from database.
This is just an example! Ensure you make any necessary modifications and run any necessary testing. This has NOT been tested.
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.