Skip to Content Skip to Menu

šŸŽƒ Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] CB Auto Action After Save Registration; available fields?

9 years 1 month ago - 9 years 1 month ago #270049 by Thelowlandpiper
What fields are available to the query using the After Save User Registration? My new user is filling in all the fields included in the query field list, but I am seeing a 1054 error. I'm assuming that all the fields filled in are available to the query using just the field name; is this correct?

Also, the user must select a subscription plan; is the plan_id of the subscription table available to the query? I am using SQL queries in the plans to store this info but it would be easier to manage if the action query could handle it.
Last edit: 9 years 1 month ago by krileon.

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

9 years 1 month ago - 9 years 1 month ago #270050 by Thelowlandpiper
Replied by Thelowlandpiper on topic CB Auto Action After Save Registration; available fields?
Duh; read the tutorial and see that I need [] round the field names.
Last edit: 9 years 1 month ago by Thelowlandpiper.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 1 month ago #270097 by krileon

What fields are available to the query using the After Save User Registration? My new user is filling in all the fields included in the query field list, but I am seeing a 1054 error. I'm assuming that all the fields filled in are available to the query using just the field name; is this correct?

The entire POST data and any fields you have in CB > Field Management. I recommend using the below triggers though for what you're implementing to work for frontend and backend registrations.

onAfterUserRegistration, onAfterNewUser

Also, the user must select a subscription plan; is the plan_id of the subscription table available to the query? I am using SQL queries in the plans to store this info but it would be easier to manage if the action query could handle it.

Possibly, but it'd be in the POST data. I recommend just using CBSubs SQL Actions if you need to act on subscription state change or acting on the appropriate CBSubs triggers in CB Auto Actions for CBSubs behavior.


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.

9 years 1 month ago #270136 by Thelowlandpiper
Replied by Thelowlandpiper on topic CB Auto Action After Save Registration; available fields?
I'm now using AfterNewUser action but the simplest query is failing with 1054 error .
Code:
INSERT INTO `j25_virtuemart_vmusers` (`virtuemart_user_id`) VALUES ([user_id])

and this query seems to do nothing at all:
Code:
INSERT INTO j25_virtuemart_userinfos( virtuemart_user_id, last_name, first_name, phone_1, address_1, address_2, city',state, virtuemart_country_id, zip) VALUES ([user_id], [lastname], [firstname], [phone], [location], [address], [city], [state], [cb_select_country], [zipcode])
(I am using the virtuemart Countries table to fill the cb_select_country query drop-down, to get an integer value, as required)

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 1 month ago #270154 by krileon
Your query isn't valid. Surround your substitutions with single quotes when used in a query. Example as follows.

'[user_id]'

We do sanitize the substitutions to be query safe, but we don't add the quotes automatically as there's various usages where that'd break things.

Your second query also has broken SQL. You've a rogue single quote after city in your column list. Example as follows how it should be formatted.

Code:
INSERT INTO `j25_virtuemart_userinfos` ( `virtuemart_user_id`, `last_name`, `first_name`, `phone_1`, `address_1`, `address_2`, `city`, `state`, `virtuemart_country_id`, `zip` ) VALUES ( '[user_id]', '[lastname]', '[firstname]', '[phone]', '[location]', '[address]', '[city]', '[state]', '[cb_select_country]', '[zipcode]' )


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.

9 years 1 month ago - 9 years 1 month ago #270172 by Thelowlandpiper
Replied by Thelowlandpiper on topic CB Auto Action After Save Registration; available fields?
Thanks for the information; however I have set the action for AfterUserRegistration with the single query
Code:
INSERTĀ INTO `j25_virtuemart_vmusers` ( `virtuemart_user_id`) VALUES ('[user_id]')
and am getting the 1054 error message again [when I tried the AfterNewUser trigger nothing happened]

When I use the Click to Execute option on the Globals page of the plugin, it works, inserting a record in the vmusers table with virtuemart_user_id =0; the same applies to the second query; test works; real data fails error 1054
Last edit: 9 years 1 month ago by Thelowlandpiper. Reason: added new test result

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

Moderators: beatnantkrileon
Powered by Kunena Forum