Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] After login redirect based on user subscription status

  • Wirex
  • Wirex
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
8 years 6 months ago - 8 years 6 months ago #280534 by Wirex
Hello,


I would like to redirect user whose subscription has expired to his profile page after login.
I'm trying to use auto action with redirect type and onAfterLogin trigger but I having a problem with setting up correct condition for it as I want redirect only users with expired subscription.

I have 4 CBSubs plans on my site. All of them are exclusive.

Appreciate help on setting the right condition for it.

Thnaks,
Wirex
Last edit: 8 years 6 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 6 months ago #280556 by krileon
You're not going to be able to unless you've a field that outputs their subscription status that you can condition against. So you'd need a CB Query Field to query for their subscription status then condition against that query field in your action.

The below query can be used to determine if they've at least 1 active plan, which should be fine for your usage since you've 4 exclusive plans.

Field Name: [cb_active_subs_count]
Query:
Code:
SELECT COUNT(*) FROM `#__cbsubs_subscriptions` WHERE `user_id` = '[user_id]' AND `status` = 'A'

Then you'd condition for your query field as follows.

[cb_active_subs_count] Less Than or Equal To 0


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: Wirex

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

  • Wirex
  • Wirex
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
8 years 6 months ago #280563 by Wirex
Hi Kyle,

Many thanks. It worked. I just got one more question regarding more then one redirect auto actions. On my site I have two redirect auto action:
1st is for user without active subscription as you suggested above - redirect to profile page
2nd is for all users (no condition set up) - redirect to other page i.e. Events

With above I would expect that when user without active subscription will login to my site he will be redirected to profile page and then immediately to Events page. But in fact he is redirected to profile page only. I suspect that if I have two or more same type (redirect) auto action they are run until first action meet condition. Can you confirm if my understanding is correct?


Thanks,
Wirex

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 6 months ago - 8 years 6 months ago #280597 by krileon
You shouldn't need a second redirect action. Instead edit your CB Login module and set the login redirect url under login options to your events URL (non-SEF beginning with index.php).

If you've 2 actions acting on the same trigger then yes they'll execute 1 after another in the order specified in CB Auto Actions.


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.
Last edit: 8 years 6 months ago by krileon.

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

  • Wirex
  • Wirex
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
8 years 6 months ago #280618 by Wirex
Ok, thanks. Works like a harm :)

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

Moderators: beatnantkrileon
Powered by Kunena Forum