CB AutoSubs Assign to a field

10 years 5 months 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 to join the conversation.

10 years 5 months ago - 10 years 5 months 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.

Please Log in to join the conversation.

10 years 5 months 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 to join the conversation.

10 years 5 months 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 to join the conversation.

10 years 5 months 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 to join the conversation.

10 years 5 months ago - 10 years 5 months 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.

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.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.313 seconds

Facebook Twitter LinkedIn