Assign Joomla Group based on Specific Login Module

7 years 3 months ago #262834 by krileon

This doesn't work — when I go to the module page and try to create a new account, the url for the new registration page with the "special=1" gives an error code saying I have to log in or register to view my profile.

Then the URL probably wasn't modified correctly. Do you have SEF enabled? What URL is it taking you to? Again, all of this is examples; I did not test it.

Also: There's no trigger for AfterUserRegistration. There's a frontend user registration trigger.

The frontend registration trigger is AfterUserRegistration. You can use the dropdown or copy/paste and press enter to add the trigger, whichever you prefer.

If you're going to redirect after registration you have to use onAfterSaveUserRegistration. All other registration triggers are too early in the registration process and could break the registration workflows. For a redirect you just use a Redirect action and not a Code action.

I highly recommend checking out the below usecases and videos to become more familiar with CB Auto Actions.

www.joomlapolis.com/support/tutorials/107-use-cases
www.youtube.com/playlist?list=PLp0puRITgC7McQcw0Sli1qfSUQGwmflzi


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.

7 years 3 months ago #262842 by kevinburk

krileon wrote:
The frontend registration trigger is AfterUserRegistration. You can use the dropdown or copy/paste and press enter to add the trigger, whichever you prefer.


I don't know what you're referring to. There is no AfterUserRegistration trigger option in the CB 3 version of AutoActions.

Please Log in to join the conversation.

7 years 3 months ago #262856 by krileon
The trigger dropdown is not set in stone. It's not a list of all available triggers. It's also not a list of triggers you're limited to. It does not have the new triggers added in CB 2.x yet. That trigger was added in CB 2.x. Simply copy, paste, and press enter and the trigger will be added.


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.

7 years 3 months ago #262864 by kevinburk
It doesn't work. I've tried all permutations and I still end up on this page after registration:

therealastrology.com/TALENT2/cb-profile/saveregisters.html

I'm quite frustrated by this. This shouldn't be so difficult. I just need to be able to specify the landing page after a registration from this particular module.

Please Log in to join the conversation.

7 years 3 months ago #262957 by krileon

I just need to be able to specify the landing page after a registration from this particular module.

What you want does not exit. In Joomla or in CB. Joomla does not keep track of this information. So what you want is not simple for Joomla or for CB. If you did the usergroup assignment and redirect based off a field instead of what module they came from it'd be a 5 minute implementation, but because you want it to work off a specific module it's not going to be easy, but it is doable.

I've tested the below as working.

Action 1
Triggers: onAfterLoginForm
Type: Code
User: Automatic
Access: Everybody
Conditions: [var4] Equal To MODULE_CLASS_SUFFIX_HERE
Method: jQuery
Code:
$( '.cbLoginForm' ).each( function() {
    var regUrl = $( this ).find( '#form-login-register > a' ).attr( 'href' );

    $( this ).prepend( '<input type="hidden" name="special_group" value="1" />' );
    $( '.cbLoginForm #form-login-register > a' ).attr( 'href',  regUrl + ( regUrl .indexOf( '?' ) < 0 ? '?' : '&' ) + 'special=1' );
});

Action 2
Triggers: onBeforeRegisterFormDisplay
Type: Code
User: Automatic
Access: Everybody
Conditions: [get_special] Equal To 1
Method: jQuery
Code:
$( '.cbRegistration > form' ).prepend( '<input type="hidden" name="special_group" value="1" />' );

Action 3
Triggers: onAfterLogin,onAfterUserRegistration
Type: Usergroup
User: Automatic
Access: Everybody
Conditions: [post_special_group] Equal To 1
Mode: Add Usergroups
Groups: SELECT_GROUPS_TO_ADD_HERE

Action 3 can be whatever you like, but the above will add usergroups based off the user logging in or registering from your specific module. I've tested this entire process as working. For the 3rd action ensure the 2 triggers are actually 2 triggers by copy and pasting them 1 by 1 and pressing enter after each (do not copy as 1 giant string with the comma as that's not a trigger).


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: nant, kevinburk

Please Log in to join the conversation.

7 years 3 months ago #263934 by kevinburk
Sorry it's taken me so long to reply. I've finally had a chance to test the code, and it works perfectly. Thank you so much for all of you support with this.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.176 seconds

Facebook Twitter LinkedIn