Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

CB Fields Plugin not updating dates

11 years 5 months ago #230163 by derekkoopowitz
CB Fields Plugin not updating dates was created by derekkoopowitz
Just installed CB Subs - love it! I do have an issue though...

In the CB Fields plugin, several custom CB fields are updated after membership/subscription is approved... 2 date fields (membership join date) and (membership expiry date), plus a couple of other fields. I'm using the user subscription substitution fields [SUBSCRIPTION_SIGNUP_DATE] and [SUBSCRIPTION_EXPIRY_DATE] to update the 2 date fields and assigning values to the other fields. The values I assign to the other fields get applied but the date fields using the substitutions do not update at all - they remain blank. If I hard code the expiry date as 2013/12/31 then that value gets applied. I suspect the format of the [SUBSCRIPTION_SIGNUP_DATE] and [SUBSCRIPTION_EXPIRY_DATE] is mm/dd/yyyy and that's why the date isn't being saved. Is there a way to convert the date during the substitution or do I change the date format in CB configuration from mm/dd/yyyy to yyyy/mm/dd?

Also, I noticed that when I as the user delete my subscription (or the admin does it), the fields are not being set to the values that I'd specified for them on expiry of the membership.

I've attached a screen shot of the CB Fields screen showing the values...

Attachments:

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
11 years 5 months ago #230274 by krileon
Replied by krileon on topic CB Fields Plugin not updating dates
Dates are already formatted I believe, you'll need to save them to text fields. Once changed to text fields please test and see if is working properly then.


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 or Create an account to join the conversation.

11 years 5 months ago #230306 by derekkoopowitz
Replied by derekkoopowitz on topic CB Fields Plugin not updating dates

krileon wrote: Dates are already formatted I believe, you'll need to save them to text fields. Once changed to text fields please test and see if is working properly then.


Correct... both dates are already formatted so when I saved them to text fields they came out as 07/05/2013 for the date joined and then 12/31/2013 for the expiry date.

So how do I save these dates to a CB date field that is expecting them in a yyyy/mm/dd format?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
11 years 5 months ago #230371 by krileon
Replied by krileon on topic CB Fields Plugin not updating dates
The only workaround is to use CBSubs SQL Actions and insert the values directly to database as there is no way to stop them from being formatted. The below example will format the date back to database safe and update a field with it.

Code:
UPDATE `#__comprofiler` SET `cb_datefield` = STR_TO_DATE( '[SUBSCRIPTION_SIGNUP_DATE]', '%d/%m/%Y' ) WHERE `id` = '[user_id]'

More information on STR_TO_DATE can be found below. The second parameter basically tells the function what format to expect the date to be in and it then turns it into database safe.

dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html#function_str-to-date


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 or Create an account to join the conversation.

11 years 5 months ago #230377 by derekkoopowitz
Replied by derekkoopowitz on topic CB Fields Plugin not updating dates

krileon wrote: The only workaround is to use CBSubs SQL Actions and insert the values directly to database as there is no way to stop them from being formatted. The below example will format the date back to database safe and update a field with it.


Thanks Kyle. So that takes care of the date issue... what about the other issue where the text fields are not being updated to the values I've specified when a membership expires? I have several fields that need to be updated when a membership expires - they get set correctly on joining but do not get set when I delete the membership or it expires.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
11 years 5 months ago #230430 by krileon
Replied by krileon on topic CB Fields Plugin not updating dates


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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum