Skip to Content Skip to Menu

🌲 Last Day for Great Savings on Professional and Developer Memberships in 2024! Get 25% off now with code XMAS-2024!

CB AutoSubs Assign to a field

  • inet2800
  • inet2800
  • OFFLINE
  • Posts: 19
  • Thanks: 0
  • Karma: 0
11 years 1 month ago #236760 by inet2800
CB AutoSubs Assign to a field was created by inet2800
Hi,

I want to assign the result of a query to a cb field using CB Auto Actions onUserLogin event.

I tried to do something like: [cb_address] = "my query"; and it doesn't work. My query works but I don't know how to assign to a field and I didn't find any documentation.

Best Regards,
Lucas

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48635
  • Thanks: 8307
  • Karma: 1446
11 years 1 month ago - 11 years 1 month ago #236765 by krileon
Replied by krileon on topic CB AutoSubs Assign to a field
Use a field action, select the field you want to change, leave operator to "Set", then substitute in your query field (e.g. [cb_myfield]) as the value. You should use the after login trigger to ensure a user object is present as on user login I believe does not have a user object yet.


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.
Last edit: 11 years 1 month ago by krileon.

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

  • inet2800
  • inet2800
  • OFFLINE
  • Posts: 19
  • Thanks: 0
  • Karma: 0
11 years 1 month ago #236771 by inet2800
Replied by inet2800 on topic CB AutoSubs Assign to a field
Kyle,

I didn't understand your answer.

This is what I have www.dropbox.com/s/wenhjtzweb25d5t/Screenshot%202013-11-12%2012.54.49.png

should I put my query in the value input?

Best Regards,
Lucas

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48635
  • Thanks: 8307
  • Karma: 1446
11 years 1 month ago #236774 by krileon
Replied by krileon on topic CB AutoSubs Assign to a field
No, you need to create a Query field using CB Query Field. This will allow your querys results to behave like a normal CB field. Next you substitute in your CB Query Field as value (e.g. [cb_myqueryfield]).


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.

  • inet2800
  • inet2800
  • OFFLINE
  • Posts: 19
  • Thanks: 0
  • Karma: 0
11 years 1 month ago #236777 by inet2800
Replied by inet2800 on topic CB AutoSubs Assign to a field
I did that.
The problem is every time that I go to my profile page that query is being executed again.
I want to execute only once when the user register and if he goes to his profile page that query won't be execute again.

Am I doing something wrong?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48635
  • Thanks: 8307
  • Karma: 1446
11 years 1 month ago - 11 years 1 month ago #236780 by krileon
Replied by krileon on topic CB AutoSubs Assign to a field
If you don't want it available as a field then doing a basic update query with your query as a sub query should work fine. Example usage as follows.

Code:
UPDATE `#__comprofiler` SET `cb_address` = ( YOUR SUB QUERY HERE ) WHERE `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.
Last edit: 11 years 1 month ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum