Skip to Content Skip to Menu

[SOLVED] Cbsubs plan image + automatic subscription

13 years 2 months ago - 13 years 2 months ago #171842 by mgranocchia

mgranocchia wrote: 2) How can i subcribe an user (automatically) after registration based on a field?
(Example: user1 is woman -> subscription 1, user2 is man -> subscription 7)

Solution:

1 --- install cbqueries
2 --- new query
3 --- Trigger: onAfterUserRegistration
4 --- User: User
5 --- Conditional: Sex == Woman (or any other condition)
6 --- query:
"
INSERT INTO #__cbsubs_subscriptions(status,user_id,plan_id,subscription_date,last_renewed_date) VALUES ('A',[user_id],4*,CURRENT_DATE,CURRENT_DATE)
"
*the plan id, as in cbsubs_plans on your database
Last edit: 13 years 2 months ago by mgranocchia.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48424
  • Thanks: 8274
  • Karma: 1443
13 years 2 months ago #171870 by krileon
Don't recommend direct queries as NONE of the CBSubs integrations will fire. This means if you've SQL Actions on plan "4" then they won't execute in the above case. Once CBSubs API has become more widely available I'll provide a trigger based subscription integration.


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

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

Moderators: beatnantkrileon
Powered by Kunena Forum