[SOLVED] Copy fields from table to table

11 years 8 months ago - 11 years 8 months ago #208640 by tgribble
Hello

I am trying to display cbsubs expiry data on a online membership card for members of the site

i have tried substituting [SUBSCRIPTION_EXPIRY_DATE]into an article with {cb:[SUBSCRIPTION_EXPIRY_DATE]} but this wont substitute. if you can tell me how to do this then the next part of the forum is moot.


my second thought was to do an autoaction query to copy the subscription date to the comprofiler table but i can get this to work either

INSERT INTO `#__comprofiler` (`cb_expirydate`) SELECT `expiry_date` FROM `#__cbsubs_subscriptions` WHERE `user_id` = '[user_id]'

can someone help me with either of these ?

thanks

Please Log in to join the conversation.

11 years 8 months ago #208730 by krileon
Replied by krileon on topic Re: Copy fields from table to table
CBSubs substitutions don't work outside of CBSubs. Your best solution is to query CBSubs _subscriptions database and pull their expiration date using a CB Query Field then you can use that query field in your 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.

11 years 8 months ago #208734 by tgribble
Replied by tgribble on topic Re: Copy fields from table to table
Hi Kyle

I'm no genius at MySQL. How far off am I with the query above?

Thankyou

Please Log in to join the conversation.

11 years 8 months ago - 11 years 8 months ago #208755 by krileon
Replied by krileon on topic Re: Copy fields from table to table
That's an INSERT. You've been trying to insert the expiration date to a CB field. No need for that unless you want to search the field (query fields can't be searched). Your select query for the expiration date is wrong though; you'd use the below.
SELECT `expiry_date` FROM `#__cbsubs_subscriptions` WHERE `user_id` = '[user_id]' AND `status` = 'A' LIMIT 1

The above would grab their first active subscription row and output the expiration date. If you need it to be plan specific just extend the WHERE statement with "AND `plan_id` = PLAN_ID_HERE" (without quotes).


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.

11 years 8 months ago #208791 by tgribble
Replied by tgribble on topic Re: Copy fields from table to table
Thankyou

Please Log in to join the conversation.

11 years 8 months ago #208843 by tgribble
Replied by tgribble on topic Re: Copy fields from table to table
thanks again.

one last question please. since the query is of a date stamp it is formatted to 2015-06-07 22:15:58 format. is there a way to adjust that to another format?

how can i display it as dd/mm/YYYY - it is set to do that in the CB configuration - general but is not displaying as such. do i have to use [cb:date format ?????] to get it to work somehow? i think it is because i am using the info in an article.

the usage is {cb:[cb_querymembershipexpiry]} which gives 2015-06-07 22:15:58

thanks

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.177 seconds

Facebook Twitter LinkedIn