Display / Hide Mosets Tree Fields Based on CBSubs

12 years 1 month ago #195750 by jimmoeller
I'm using Mosets Tree as a resource directory for my site and I'd like to display or hide some Mosets Tree fields based on the user's CBSubs subscriber plan level.

I'm thinking this shouldn't be too hard and can potentially be handled directly in the Mosets Tree display template.

Is there an easy way to access the CBSubs subscriber plan level in the Mosets Tree template? Does it require an SQL query?

Jim

Please Log in to join the conversation.

12 years 1 month ago #195806 by krileon
CBSubs can't add features that don't exist in an extension. If the extension has permissions for field access such as viewaccesslevels or usergroups you can use CBSubs to add users to those usergroups which would give access to those protected fields. Aside from that there's not much you can do in this regard if the extension it self has nothing to provide field access.


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.

12 years 1 month ago #195826 by jimmoeller
I'm currently modifying a Mosets Tree template to display the directory information the way I'd like. My thinking here, and where I was looking for some guidance, is in potentially adding a simply SQL query to access the current users CBSubs subscriber plan, and then use that subscriber plan ID as a filter in displaying or hiding the Mosets Tree info.

So, yes, I'm aiming to add functionality in the Mosets Tree template that doesn't already exist. I'm not expecting CBSubs to provide that functionality. I'm just simply looking for a bit of guidance on a simple SQL query that accesses a users CBSubs plan ID.

Does that all sound plausible? Or am I missing something here?

Please Log in to join the conversation.

12 years 1 month ago #195839 by krileon
Ah, I see. Yes that's doable. You'd need to simply query _cbsubs_subscriptions for a users subscription. Example as follows.
SELECT `id` FROM `#__cbsubs_subscriptions` WHERE `user_id` = USER_ID AND `plan_id` = PLAN_ID AND `status` = 'A'

You'll need to replace USER_ID and PLAN_ID as necessary. The status check ensures the subscription is active.


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.

12 years 1 month ago #196234 by jimmoeller
O.k., I was able to get that to work quite well.

Is there a database in which all the plan IDs are stored? If so, could you post a simple query for that.

I can manually enter all the plan IDs, but I just thought it would be better if I could pull up all the plan IDs automatically.

Also, are there architectural documents that describe all the CB and CBSubs databases....I guess that would save me from asking here.

Please Log in to join the conversation.

12 years 1 month ago #196245 by nant

jimmoeller wrote: Is there a database in which all the plan IDs are stored? If so, could you post a simple query for that.


Easy enough to find ... _cbsubs_plans

I can manually enter all the plan IDs, but I just thought it would be better if I could pull up all the plan IDs automatically.


As plan table also contain Merchandise and Donation plans, I am not sure you really want all of the planids. I would hard-code them once as you might have planids that you do not need.

Also, are there architectural documents that describe all the CB and CBSubs databases....I guess that would save me from asking here.


CB API document in free download area has CB database schema.
Nothing exists for CBSubs yet.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.183 seconds

Facebook Twitter LinkedIn