[SOLVED] Using cbsubs substitutions in fields

10 years 7 months ago - 10 years 7 months ago #234247 by don5420
I am trying to use the plan_id or plan_name in a field to display information with an 'if' statement.

I found the use case tutorial here: www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb and the forum topic for cbsubs substitutions here: www.joomlapolis.com/forum/6-news-and-publicity/217670-cbsubs-30-goes-gpl#217673

However, I cannot seem to get them to work together. I even resorted to scrapping the 'if' statement and just tried to display the plan_name. If I put [user_id] in the field it works by displaying the user_id number. (I have tried it with other fields and it works) I cannot get it to work with any of the cbsubs fields. I tried [plan_id], [plan_name], and {cbsubs:plan:PlanId:CB + [PLAN_NAME]} and nothing works.

Please help.

EDIT: I have CBSubs Content and cbpaidsubsbot enabled. The forum post states: "and here is how to use it (with CB Content CBSubs integration plugin and cbpaidsubsbot both active):" I am assuming that CBSubs Content is the plugin referred to above. It isn't very clear since he refers to it as Content CBSubs (which is backwards from how it is listed)

Also, do you have a list of all of the possibilities somewhere? Or maybe the command structure?

Please Log in to join the conversation.

10 years 7 months ago - 10 years 7 months ago #234258 by krileon
Replied by krileon on topic Using cbsubs substitutions in fields

am trying to use the plan_id or plan_name in a field to display information with an 'if' statement.

I'm pretty sure the CBSubs substitutions don't work in IF substitutions. They can only be used to display information.

However, I cannot seem to get them to work together. I even resorted to scrapping the 'if' statement and just tried to display the plan_name. If I put [user_id] in the field it works by displaying the user_id number. (I have tried it with other fields and it works) I cannot get it to work with any of the cbsubs fields. I tried [plan_id], [plan_name], and {cbsubs:plan:PlanId:CB + [PLAN_NAME]} and nothing works.

The usage is as follows.

{cbsubs:plan:42:[PLAN_NAME]}

Where "PlanId" is you need to replace it with your actual plans ID found in CBSubs > Plans as shown in the example above. This also only works in Joomla articles (or anywhere that processes Joomla Content Plugins) like CB Content Bot provides for regular 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.

10 years 7 months ago #234261 by don5420
Replied by don5420 on topic Using cbsubs substitutions in fields
Thanks for the reply, but that isn't at all what I am looking to do. I only referenced the forum article because it was all I could find and it showed that it was possible. I need to know how to display the current users cbsubs information. And I need to know what information I can display.

Although, now that I read the forum post again, it looks like all you can do is display static information using what is discussed in that post.

With all of that being said, is there any way to display the current logged in users plan_id?

Please Log in to join the conversation.

10 years 7 months ago - 10 years 7 months ago #234271 by krileon
Replied by krileon on topic Using cbsubs substitutions in fields

Thanks for the reply, but that isn't at all what I am looking to do. I only referenced the forum article because it was all I could find and it showed that it was possible. I need to know how to display the current users cbsubs information.

I've given you an example in my previous reply showing you how to display CBSubs information.

And I need to know what information I can display.

The topic you linked provides that for you already. Please see the below.

[USERNAME], [NAME], [cb_anycbfieldname]

[PLAN_NAME], [PLAN_ALIAS], [PLAN_DESCRIPTION], [PLAN_REGISTRATION_PRICE] and [PLAN_UPGRADE_PRICE] (both display period and price), [PLAN_PRICE] (display generic period and price for plan, or amount donated for donation with currency, or price with currency of product for a merchandise), [PLAN_RATE] and [PLAN_FIRST_RATE] are numeric values, and in case of donations, the donation amount converted into the donation plan's currency

[SUBSCRIPTION_SIGNUP_DATE], [SUBSCRIPTION_EXPIRY_DATE], [SUBSCRIPTION_LAST_RENEWAL_DATE], [SUBSCRIPTION_VALIDITY_PERIOD_REMAINING], [SUBSCRIPTION_EXPIRY_DATE_IF_RENEWED], [SUBSCRIPTION_VALIDITY_PERIOD_IF_RENEWED], [SUBSCRIPTION_RENEWAL_PRICE] (displays period and price)


Although, now that I read the forum post again, it looks like all you can do is display static information using what is discussed in that post.

It can display some subscription information. Please see above.

With all of that being said, is there any way to display the current logged in users plan_id?

No, not unless you query for it using CB Query Field or have stored it to a field that you can substitute in. The CBSubs substitutions require you to supply the plan id so it knows what plan to substitute in.


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.

10 years 7 months ago #234282 by don5420
Replied by don5420 on topic Using cbsubs substitutions in fields
Thanks for that information. I suspected that the only way was how I had done it before, but wanted to ask to be sure. Can you tell me if there is a better way than this?

I created a field of type query that grabs the payment status of their merchandise. It either returns NULL or Completed. I then used that query result with cb:if to display whether they had purchased that merchandise or not and whether to show that merchandise as an option to be purchased. The only downside is that I cannot make use of that query field in my cb:if statement unless I choose "Show on Profile". Which means I have to display a blank line/the word completed. This doesn't look great, but I have made it work. This is how I will have to figure out their plan_id and use it. But again, I will need to display whatever I query to make use of it in cb:if statements. Not ideal.

Can you recommend a better way to do this or tell me how I can hide the field and still use the values it returns?

Please Log in to join the conversation.

10 years 7 months ago #234285 by krileon
Replied by krileon on topic Using cbsubs substitutions in fields
That's still the best approach. You however don't have to display the query field on their profile. Create a new tab in a not shown on profile position then put your query field on it.


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.236 seconds

Facebook Twitter LinkedIn