Skip to Content Skip to Menu

Autoaction throws SQL error

  • kdave321
  • kdave321
  • ONLINE
  • Posts: 205
  • Thanks: 26
  • Karma: 2
22 hours 13 minutes ago - 22 hours 12 minutes ago #340581 by kdave321
Autoaction throws SQL error was created by kdave321
I wrote my own point reward system where various user actions get points in my own table.

One is a simple SQL after onAfterFirstLogin:
Code:
INSERT INTO #__user_points_history (user_id, reward_date, points, reward_for) VALUE ('[user_id]', CURDATE(), '1', 'First Login');

This was working great in J3 and now throws this error in J4:

Incorrect integer value: '' for column `numnalac`.`ngury_user_points_history`.`user_id` at row 1

But the table is actually updated correctly with the correct user_id. It's like the SQL runs twice but the 1st time has "incorrect integer value"?

I have no condition to execute the SQL and output is none.  There are no constraints on the columns in the table.

Perhaps something needs to be changed for J4?
Last edit: 22 hours 12 minutes ago by kdave321. Reason: typo

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48925
  • Thanks: 8366
  • Karma: 1453
13 hours 11 minutes ago #340582 by krileon
Replied by krileon on topic Autoaction throws SQL error
Are you sure that error is coming from CB Auto Actions? CB Auto Actions catches all errors and would only display that error if debug mode for the auto action is enabled. It would also display it in the following format.
Code:
:: Action ACTION_ID_HERE :: Query failed. Error: QUERY_ERROR_HERE

Is it possible you've something else configured or installed that could be making the query that's erroring?


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.

  • kdave321
  • kdave321
  • ONLINE
  • Posts: 205
  • Thanks: 26
  • Karma: 2
9 hours 23 minutes ago #340587 by kdave321
Replied by kdave321 on topic Autoaction throws SQL error
OK, I think I found it. I had 2 autoactions for onAfterFirstLogin. The one above works fine but the other one is attempting to give points to the person who invited them. It's the only one with debug on.

But the test person I was using was added manually with no invite, so I had this Condition to exclude it:
Field: Value
Custom Value: $( '#cb_referrer_id' )
Operator: Not Empty

cb_referrer_id is a field I created that runs Query:
SELECT `user_id`
FROM `#__comprofiler_plugin_invites`
WHERE `user` = '[user_id]'
LIMIT 1

I don't know why that condition fails and tries to run the auto action sql anyway.

But then the "no page found" error page I get is because CB was still configured to go to J3 profile, so I fixed that.  Now when I repeat the new member process, he logs into his profile but just sees the error message "Incorrect integer value: '' for column `numnalac`.`ngury_user_points_history`.`user_id` at row 1 " at the top.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48925
  • Thanks: 8366
  • Karma: 1453
8 hours 30 minutes ago #340588 by krileon
Replied by krileon on topic Autoaction throws SQL error

Field: Value
Custom Value: $( '#cb_referrer_id' )
Operator: Not Empty

That's not a valid condition. You seam to be trying to run jQuery? If you want to check if they have a referrer id just select that field from the dropdown or condition against [cb_referrer_id] custom value.


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 following user(s) said Thank You: kdave321

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

  • kdave321
  • kdave321
  • ONLINE
  • Posts: 205
  • Thanks: 26
  • Karma: 2
8 hours 21 minutes ago #340589 by kdave321
Replied by kdave321 on topic Autoaction throws SQL error
lol. I think I was copying some post on here....  So I just selected the field instead and no more error.

Thanks.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum