I need to add the current date to a custom user field at the time a subscription is made. I don't see a way to do that in the sub Integration tabs... so I thought maybe I could add it using a SQL query. Here's way I can so far. It doesn't see to have an effect.
UPDATE '#_comprofiler' SET 'cb_customfield' = CONVERT (date, GETDATE()) WHERE `user_id` = [user_id]
UPDATE `#_comprofiler` SET `cb_customfield` = NOW() WHERE `user_id` = [user_id]
OR
UPDATE `#_comprofiler` SET `cb_customfield` = CURDATE() WHERE `user_id` = [user_id]
OR your original but fixed
UPDATE `#_comprofiler` SET `cb_customfield` = CONVERT (date, GETDATE()) WHERE `user_id` = [user_id]
You single quoted tables and columns. Use ` instead of '. Only use ' and " for values.
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.
The fields doesn't change when I add the subscriptions to a user. It remains blank.
I added a custom field called cb_workshop001. It is a date type. The field-specific parameters are default. I haven't touched the CBSubs Fields Tab Protect... area.
The SQL string is copied and pasted in to the SQL Action 1 on ACTIVATION area.
Yet when I add the subscription to the a user, the cb_workshop001 field remains empty.
It's probably not in the right format. Also just noticed an error with the table name.
Change:
#_comprofiler
To:
#__comprofiler
Example:
UPDATE `#__comprofiler` SET `cb_customfield` = DATE_FORMAT( CURDATE(), '%Y-%m-%d' ) WHERE `user_id` = [user_id]
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.
Thanks for the reply. I still don't have the custom field updated.
The difficult thing is that there is not error message or log to see it the SQL is invalid and why. Do you know of a way to test it? Maybe using phpMyAdmin?