[SOLVED] Redirect to on login to GJ Group

4 years 8 months ago - 4 years 8 months ago #313392 by kdave321
RE: www.joomlapolis.com/forum/153-professional-member-support/232694-auto-actions-redirect-to-jive-group-based-on-profile?start=6

This is precisely what I hope to do too. No followup so I assume you found a solution.

I can successfully redirect URL on login to a groupjive page with an URL like this:
index.php/categories/6-communities/5-gardeners
,but I don't see how to set the URL dynamically. Each user (in this Joomla group) will have a single gj group they belong to.

I can construct the URL from the SQL -
select a.user_id, category, c.name, b.id, b.name from my_groupjive_users as a, my_groupjive_groups as b, my_groupjive_categories as c where a.user_id = 857 and a.group = b.id and b.category = c.id;

Do I need to make that a custom CB field ( set by another auto-action)?

[MOD EDIT] Please avoid replying to extremely old topics and simply create a new topic. If you feel the old topic is still relevant then link to it, but in most cases the information is significantly out of date.

Please Log in to join the conversation.

4 years 8 months ago #313397 by krileon
Replied by krileon on topic Redirect to on login to GJ Group
You'll need to use CB Query Field to find what group they belong to. The below should work in a Query field to return the group id.

SELECT `group` FROM `#__groupjive_users` WHERE `user_id` = '[user_id]' LIMIT 1

Next you'll need a CB Auto Action to redirect them after login. The below should do this fine.

Global
Triggers: onAfterUserLoginSuccess
Type: Redirect
User: Self
Access: Everybody
Action
URL: index.php?option=com_comprofiler&view=pluginclass&plugin=cbgroupjive&action=groups&func=show&id=[FIELD_NAME]

Replace FIELD_NAME with the name of your query field containing the above query.


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.

Please Log in to join the conversation.

4 years 8 months ago #313406 by kdave321
Replied by kdave321 on topic Redirect to on login to GJ Group
Much easier - thanks! Works great.
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

4 years 7 months ago #314044 by kdave321
Replied by kdave321 on topic Redirect to on login to GJ Group
Woops - thought I could just add a condition to the auto-action so that the user has to have a GJ Group, but none of the usual seems to work. Not sure exactly what is returned by my query field ( cb_gjid ) if the user has no group. I tried "NOT EMPTY" and != "" and > 0 - nothing worked.
Perhaps the query that sets cb_gjid is not performed until conditional returns it?...

Please Log in to join the conversation.

4 years 7 months ago #314045 by kdave321
Replied by kdave321 on topic Redirect to on login to GJ Group
OK, I tried to do a CB Substitution instead. Picked VALUE, entered [cb_gjid], enabled content plugin, and said operator = "NOT EMPTY" - and that seems to work.

Please Log in to join the conversation.

4 years 7 months ago #314051 by krileon
Replied by krileon on topic Redirect to on login to GJ Group
Query fields are not stored in the database so you can't query on their field names directly like you can a text field for example. They just return the results of your custom database query and don't store anything. So the only way to get their value into a query is substitutions or through API.


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.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.452 seconds

Facebook Twitter LinkedIn