Skip to Content Skip to Menu

Redirect unregistered users to log-in

11 years 9 months ago #220289 by philiplardner
Redirect unregistered users to log-in was created by philiplardner
Hi,

I am configuring CB/CBSubs. At present, both registered users who haven't logged in, and unregistered users who try to access restricted menu items are redirected to the registration page with the default plan displayed. I would prefer to redirect them to the home page (which has the log-in module on it) and display a message (in a module under the log-in module) telling them that they need to log-in or register. This would allow registered users to log-in without having to escape back to the home page without seeing an inappropriate (for them) registration page.

I know I could simply hide the restricted menu items from unregistered users, but I want them to see what they are not able to access until they pay for registration.

Pretty please - how do I do this? :-)

Thanks,

Philip.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
11 years 9 months ago #220332 by krileon
Replied by krileon on topic Redirect unregistered users to log-in
There's no parameter to change this. You'd need to edit the CBSubs Content plugin to change the redirects. The below file is what you'd need to review and edit.

components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/plugin/cbsubscontent/cbsubs.content_access.php

Note we do not support core edits so can not help beyond this point. This also only applies to CBSubs 3.x GPL of course.


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.

11 years 9 months ago #220489 by philiplardner
Replied by philiplardner on topic Redirect unregistered users to log-in
Hmm... I've just looked at the code and I don't think I'm up to hacking it safely, so I'll go with Plan-B and simply hide those restricted items!

Thanks anyway,

Phil.

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

11 years 9 months ago - 11 years 9 months ago #221119 by philiplardner
Replied by philiplardner on topic Redirect unregistered users to log-in
Hi Kyle,

Returning to my original query, above - could the CB Auto Action plugin be used to redirect unregistered and registered users who haven't logged-in to the login prompt (or to a specified page) rather than hit them with the full registration page?

Alternatively, is it possible to display the CB Login module above the new user Registration form / CBsubs plans? this would also solve the problem.

Thanks,

Phil.
Last edit: 11 years 9 months ago by philiplardner.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
11 years 9 months ago #221216 by krileon
Replied by krileon on topic Redirect unregistered users to log-in
I believe CB Auto Actions can. Try the below.

Type: Redirect
Trigger: onBeforeRegisterForm
Access: All Non-Registered Users
Conditional: [get_do] Equal To displayplans
URL: index.php?option=com_comprofiler&task=login

As for module display you can try displaying the login module on the registration page. This is entirely based off Itemid so ensure you assign it to the correct menu item by reviewing the Itemid in the CBSubs registration plan page URL (ensure SEF is off when grabbing this).


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.

11 years 9 months ago - 11 years 9 months ago #221261 by philiplardner
Replied by philiplardner on topic Redirect unregistered users to log-in
Thanks Kyle - that worked with a little modification...
  • Type: Redirect
  • Trigger: onBeforeRegisterForm
  • Access: All Registered Users
  • Conditional: ---leave blank---
  • URL: index.php?option=com_comprofiler&task=login

Using "Access: All non-Registered Users" prevents new users from registering an account!

I couldn't see triggers for events like "onSession Timeout" or "onAccess Denied" - both would be useful to have in the toolbox.

Is there any documentation for CB Auto Actions to explain its full potential (or are there no docs for any of the Incubator projects yet?)

Thanks again,

Phil.
Last edit: 11 years 9 months ago by philiplardner.

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

Moderators: beatnantkrileon
Powered by Kunena Forum