Add record to foreign table when new plan created

14 years 7 months ago #109183 by ldozois
I want to allow my users access to certain features that are not part of the core Joomla functionality. We are creating custom scripts to manage these features.

I have created a table (#_cbsubs_dya_subscription_features) that contains the properties for each subscription level. The table is related to #_cbsubs_plans by #_cbsubs_plans.id.

Our scripts check #_cbsubs_dya_subscription_features to see if a user can perform a certain task or how many times they can perform it in some cases.

What I need to do is insert a new row in #_cbsubs_dya_subscription_features whenever a new plan is added to #_cbsubs_plans.

I tried adding a trigger to the #_cbsubs_plans table but that is giving me syntax problems. Before I sort out those issues, I'm wondering if this is the approach I should be taking or is there a better way I have not considered?

Please Log in to join the conversation.

14 years 7 months ago #109199 by krileon
Just use CBSubs SQL Actions plugin. You can perform queries on activation and deactivation of a subscription. Structure is the same as using a standard query in PHP. It does support substitutions as well (see tutorials in signature for help with substitutions).


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.

14 years 7 months ago #109234 by ldozois
krileon wrote:

Just use CBSubs SQL Actions plugin. You can perform queries on activation and deactivation of a subscription. Structure is the same as using a standard query in PHP. It does support substitutions as well (see tutorials in signature for help with substitutions).


Thank you for your reply. The manual state:

"The sub-tab basically provides 5 paired parameters that contain SQL statement pairs
that are to be executed when a member first joins a plan or when a member leaves a
plan."

My action need to be fired when a new PLAN is created, not when a member joins or leaves a plan.

Does the CBSubs SQL Actions plugin support that case? It doesn't look like it to me.

Len

Please Log in to join the conversation.

14 years 7 months ago #109250 by krileon
No, it does not do this. Do you plan on creating many plans? If not then firing an SQL query every now and again to do what you're wanting shouldn't be a problem as long as you're not creating plans on a daily basis, lol.


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.

Moderators: beatnantkrileon
Time to create page: 0.226 seconds

Facebook Twitter LinkedIn