Skip to Content Skip to Menu

Login redirect for custom component

9 years 6 months ago - 9 years 6 months ago #263021 by GavinErickson
Login redirect for custom component was created by GavinErickson
Hi

I'm having a problem getting cblogin to parse a redirect url for my component. I wish for someone to be logged in and taken to a particular page in my component.




Code:
$redirectUrl = "index.php?option=com_conferencebooking&view=pageone"; $redirectUrl = urlencode(base64_encode($redirectUrl)); $redirectUrl = 'index.php?option=com_users&task=login&return=' . $redirectUrl; ----- <p><a href="'.$redirectUrl.'">Login</a></p>

if I turn off redirectUrls in the Community Builder System plugin the return is processed as expected. When that setting is enabled the return does not work, and i just go to the redirect specified in the module config.

I'd be quite happy to hard code a com_comprofiler variant if necessary, rather than rely on rewriting..

thanks,

Gavin

running Joomla 3.4.1 and CB 2.0.7 on ubuntu 12.04 LTS / apache2 with SEF switched off in global config
Attachments:
Last edit: 9 years 6 months ago by GavinErickson.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
9 years 6 months ago #263043 by krileon
Replied by krileon on topic Login redirect for custom component
Enable redirect urls and rewrite urls within CBs system plugin then pass your redirect URL through JRoute::_( URL_HERE ). You also need to replace &task with &view in your URL. &task is deprecated in Joomla since J1.6. CB should then turn it into a CB login page URL. Alternatively just use CBs login page URL as follows.

index.php?option=com_comprofiler&view=login


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 or Create an account to join the conversation.

9 years 6 months ago #263094 by GavinErickson
Replied by GavinErickson on topic Login redirect for custom component
Thanks Kyle,

I tried that and had no joy - the return is ignored by comprofiler still. I haven't set any menu items for this component - would that cause issues for CB?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
9 years 6 months ago #263134 by krileon
Replied by krileon on topic Login redirect for custom component
Ah, I understand what you're wanting. That won't work with CB. CB login doesn't accept return URLs from GET. I believe the only way to get that to work is to try sending the user to Joomlas login page and formatted exactly as how Joomla expects it and our system plugin maybe able to push it to the CB login module, but that's not guaranteed to work.


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 or Create an account to join the conversation.

9 years 6 months ago #263137 by GavinErickson
Replied by GavinErickson on topic Login redirect for custom component
CB seemed to dump the return URL regardless whether approached directly or via com_users - I ended up writing a login view (basically a clone of the standard joomla )to solve the issue - thanks for your time.

best wishes,

Gavin

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
9 years 6 months ago #263143 by krileon
Replied by krileon on topic Login redirect for custom component
You can render CBs login module by loading in its module display. That's how CBs login page functions. The CB Login module it self builds the return URL based off the page you're on. Below is how this is done for example.

Code:
$query = 'SELECT *' . "\n FROM " . $_CB_database->NameQuote( '#__modules' ) . "\n WHERE " . $_CB_database->NameQuote( 'module' ) . " = " . $_CB_database->Quote( 'mod_cblogin' ) . "\n AND " . $_CB_database->NameQuote( 'published' ) . " = 1" . "\n ORDER BY " . $_CB_database->NameQuote( 'ordering' ); $_CB_database->setQuery( $query, 0, 1 ); $module = null; $_CB_database->loadObject( $module ); if ( $module ) { echo JModuleHelper::renderModule( $module, array( 'style' => 'xhtml' ) ); }


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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum