Community Builder registration redirect

9 years 2 weeks ago #201514 by ducks_mrd
Replied by ducks_mrd on topic Re: Community Builder registration redirect
Thank you however I have already downloaded that plugin, but it will not help with my question. That plugin redirects the from the joomla registration to the community builder one.

The question myself and hajopaj were asking is how to redirect the user after they have completed the community builder registration form.

In particular, I was asking can I provide the community builder registration with a "return" url and then redirect to that after the user has clicked register and community builder has completed the registration process.

In the Auto Actions plugin you can specify "goback" and I have tried using the triggers onAfterUserRegistrationMailsSent and onAfterUserRegistration but that does not work and I get redirected back to the registration page.

Thanks

Mike

Please Log in to join the conversation.

9 years 2 weeks ago #201515 by krileon
Replied by krileon on topic Re: Community Builder registration redirect
Nothing we have can provide that. It'd require storage of the return URL to session or database table or something of the sort. Then keeping track of that return URL and sending the user to it then resetting it after registration. During the registration process you're surpassing about 3 or more page loads, that's far back to be able to reliably redirect to.


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.

9 years 2 weeks ago - 9 years 2 weeks ago #201520 by ducks_mrd
Replied by ducks_mrd on topic Re: Community Builder registration redirect
Thanks for that Krileon your explanation has helped me to sort my problem.

I accept going to a url held in session for 3 or more page loads could cause issues however in this instance I think it is not an issue.
As the page loads are one after the other with no user interaction plus the way I have set the return url in the session it would take some work to reload another page.

What I have done from the start is:

1. Add your auto login code to the Auto Actions plugin found at:
www.joomlapolis.com/forum/153-professional-member-support/185909-solved-automatic-login-after-registration#185947

2. For the 2nd part of your above instruction I have added the url as "return_url".

3. I changed the file components/com_comprofiler/plugin/user/plug_cbautoactions/models/redirect.php
At line 31 I added:
} elseif ( strtolower( $redirect ) == 'return_url' ) {
$url = (isset($_SESSION['comprofiler']['return'])) ? base64_decode($_SESSION['comprofiler']['return']) : $_CB_framework->userProfileUrl();
cbautoactionsClass::setRedirect( $url, $message, ( $message ? $message_type : null ) );
}
The first line checks if you have entered the phrase "return_url" in the URL box of the Auto Actions plugin as CB already uses the phrase "return".

4. Added an Auto Action (type = code, trigger = onBeforeRegisterFormDisplay)
if (isset($_SESSION['comprofiler']['return'])) unset ($_SESSION['comprofiler']['return']);
if (isset($_GET['return'])) $_SESSION['comprofiler']['return'] = $_GET['return'];

User is now registered, logged in and redirected back to my component with the url I supplied.

I nearly got there without any core modifications of CB.

I am just wondering if you had any thoughts on this. I don't know about anyone else but I think this would be a great addition to community builder, but I accept very few people would ever need to use it.
Just people like me who have created components.

Thanks

Mike

Please Log in to join the conversation.

8 years 11 months ago #202739 by Gruz
Here is my free solution

Task:
Autologin user on clicking confirmation link in the confirmation email.
Redirect user to the initial page, the page where one have clicked on the "Register" link
OR (optionally)
to a special page passed in the "Register" link return link (explained below).

gruz.org.ua/en/about-joomla/29-joomla-extensions/13-joomla-25-community-builder-autologin-users-on-clicking-confirmation-link-in-email-redirect-user-to-the-page-before-registration-form-.html

I hope it will be usefull for someone else except me. (-:


This topic is closed: www.joomlapolis.com/forum/112-cb-122-general-discussion/130477-community-builder-registration-redirect

I would also post my solution there.

Please Log in to join the conversation.

8 years 11 months ago - 8 years 11 months ago #204430 by coltonalton
Replied by coltonalton on topic Re: Community Builder registration redirect
So is it or is it not possible to redirect a user to a specific page after registration?

Please Log in to join the conversation.

8 years 11 months ago #204431 by coltonalton
Replied by coltonalton on topic Re: Community Builder registration redirect

andrex143 wrote: Hi, if you want to redirect after registration you can do so. By modifying some core files here's how:

in comprofiler.php under components/com_comprofiler

in line 1048

1047: if ( $saveResult === true ) {
1048: $messagesToUser=activateUser($userComplete, 1, "UserRegistration" );
1049: }

change it to header('Location: <path>') ;

Hope this helps


Andrex, can you clarify this please? What exactly needs to be changed on line 1048? Should I replace the entire piece of code $messagesToUser=activateUser($userComplete, 1, "UserRegistration" ); ??? or just a portion of it?

Thanks in advance!

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.430 seconds

Facebook Twitter LinkedIn