[SOLVED] CBSubs to change username first time user subscrib

8 years 6 months ago #146171 by Ducatiklubben
Further testing has been made.
When I use CBSubs > Basket > Pay button, I get the same result. It will not update the #__users username field. :(
I did change the query so that the update would take place in a different table and that worked perfectly so the SQL action is executing and the query seems to do what it should.

Is there anything else that I could try to make this work?
8 years 6 months ago #146257 by krileon
Is your query working when subscribing from frontend by a non-offline payment gateway such as paypal sandbox or dummy gateway? The only time the query should NOT function properly is if paying by editing a user and giving them a subscription as the users data will overwrite what the query just set (due to the order of execution).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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.
8 years 6 months ago #146304 by Ducatiklubben
I just did a test, paying via paypal. There were no differences, username was not updated.

I did "register new member" on frontend, added all the mandatory fields and then did the payment via paypal. did not work.:(
8 years 6 months ago #146312 by krileon
Something is perhaps wrong then. Please enable debug mode and maximum error reporting then attempt to subscribe. This will help determine if there is a query issue or not. Please also check that the CBSubs SQL Actions plugin is public and published.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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.
8 years 6 months ago #146326 by Ducatiklubben
we are onto something here. After changing to debug level I got this:

JDatabaseMySQL::query: 1093 - You can't specify target table 'ducati_users' for update in FROM clause SQL=UPDATE `ducati_users` SET `username` = ( ( SELECT `username` FROM `ducati_users` WHERE `username` >= 1 ORDER BY `username` DESC LIMIT 1 ) + 1 ) WHERE `id` = 6675

Maybe the only way of getting round this is to post the new username to a temporary table and then use a secondary SQL statement that updates users table with the new content from the temp table... or is it possible to do something else?
8 years 6 months ago #146382 by krileon
I see, yeah that'll be a problem. You can't UPDATE a table and SELECT the same table at the same time in the same query, typically doesn't work (the query was an example). Please try the following which uses multi-table instead of sub-queries.

[code:1]
UPDATE `#__users` AS a
INNER JOIN `#__users` AS b
SET a.`username` = ( b.`username` + 1 )
WHERE a.`id` = [user_id]
[/code:1]

Again, this is just an example and may need changes to meet your needs.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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.
Moderators: beatnantkrileon
Time to create page: 0.545 seconds
Facebook Twitter Google LinkedIn