Skip to Content Skip to Menu

SQL Action 1

7 years 8 months ago #291027 by matthewdavey
SQL Action 1 was created by matthewdavey
I want when users are deleted or unsubscribe or suspend the CB Subs account the mosets listings are deleted I have tried the code from the forums

DEACTIVATION: (Unpublish Listings)
[code:1]
UPDATE `#__mt_links` SET `link_published` = 0 WHERE `user_id` = [user_id]
[/code:1]

Where do I put the code ?? I put it in CB Query field see attached but it didnt work

Do I put it in the plan CB Subs see attached

Can you enplane how to do this?
the tutorials dont have user cases any more so its hard to copy the query's where did the use case scenarios go???
Attachments:

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48448
  • Thanks: 8280
  • Karma: 1443
7 years 8 months ago #291070 by krileon
Replied by krileon on topic SQL Action 1
You'd need to do that either with CB Auto Actions or CBSubs SQL Actions. For CB Auto Actions you'd use the below usage.

Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Equal To A

Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Not Equal To A

With the above in your case you'd use a Query action. For CBSubs SQL Actions edit your plan within CBSubs > Plans then under the Integrations > SQL Actions tab you can supply your query.

Do not include the code brackets. You only should be supplying the query it self. This will not work in a query field, which just displays the results of a SELECT query.


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.

7 years 8 months ago #291121 by matthewdavey
Replied by matthewdavey on topic SQL Action 1
Can you explain this in more detail I just need the mosets listings deleted when the user unsubscribes or is deleted from website this is very confusing or can we private message the admin details to fix this issue this is all I need to launch my website live

I get Warning: Header may not contain more than a single header, new line detected in /home/mysite/public_html/mysite/libraries/joomla/application/web.php on line 947

OOPS! SOMETHING WENT WRONG

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[code:1] UPDATE `#__mt_links` SET `link_published` = 0 WHERE `user_id` = 877 ' at line 1 SQL=[code:1] UPDATE `#__mt_links` SET `link_published` = 0 WHERE `user_id` = 877 [/code:1]

Thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48448
  • Thanks: 8280
  • Karma: 1443
7 years 8 months ago #291140 by krileon
Replied by krileon on topic SQL Action 1
You're getting that error because you keep including the [code:1] tags. As instructed above don't do that. Use only the query it self. Meaning just the below.

Code:
UPDATE `#__mt_links` SET `link_published` = 0 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.

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

7 years 8 months ago #291209 by matthewdavey
Replied by matthewdavey on topic SQL Action 1
Ok Thanks it works

Is there a similar query that deletes the k2 articles of the user on deactivation as well? If so how do I set it up?
The CB Blogs plugin deletes the Blog on deactivation which is good

what do I need below for and what does it do?
Thanks

Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Equal To A

Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Not Equal To A

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48448
  • Thanks: 8280
  • Karma: 1443
7 years 8 months ago #291234 by krileon
Replied by krileon on topic SQL Action 1
I do not have a query for deleting K2 articles. I suggest posting on K2 forums regarding that then adding substitutions where needed.

what do I need below for and what does it do?

That allows any action you want to act on subscription activation and deactivation. So it could be a code action, query action, field action, etc.. You don't need it if CBSubs SQL Actions is adequate.


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