Skip to Content Skip to Menu

[SOLVED] CB Auto Action ?

10 years 3 months ago - 10 years 3 months ago #247083 by pasquale1980
[SOLVED] CB Auto Action ? was created by pasquale1980
Hi, I'm using CB Auto Action to populate a field in a table using a query. In practice I have to read a value from table1 and write it in a field on table2 but using a condition on table2.
I put this string sql:

UPDATE `#__comprofiler` SET `cb_classelaurea` = (SELECT `classe` FROM `ateneo` WHERE `id` = (SELECT `cb_corso` FROM `#__comprofiler`) WHERE `id` = '[user_id]')

but I get the following error:

You can't specify target table 'bm4i8_comprofiler' for update in FROM clause SQL=UPDATE `#_comprofiler` SET `cb_classelaurea` = (SELECT `classe` FROM `ateneo` WHERE `id` = (SELECT `cb_corso` FROM `#_comprofiler` WHERE `id` = '[user_id]'))

I tried using AS to assign an alias, but it does not work.
I understand that I can not use the condition on the table where I write the data. How should I set the query to make it work?
Thank you.

[MOD EDIT]: Please do not resurrect 2 year old topics. Simply create a new topic and link to the old topic. Topics that old often have no longer relevant information. I've moved your reply to a new topic. Original topic can be found below.

www.joomlapolis.com/forum/153-professional-member-support/185666-3104-cb-auto-action?limitstart=0
Last edit: 10 years 3 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8283
  • Karma: 1443
10 years 3 months ago #247090 by krileon
Replied by krileon on topic CB Auto Action ?
Does the field have to be stored in _comprofiler? If not just use CB Query Field and query for whatever value you want and it'll output as a normal CB field with the result. If you absolutely need it stored in _comprofiler then the below should work.

Code:
UPDATE `#__comprofiler` SET `cb_classelaurea` = ( SELECT `classe` FROM `ateneo` WHERE `id` = '[cb_corso]' ) 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 or Create an account to join the conversation.

10 years 3 months ago #247133 by pasquale1980
Replied by pasquale1980 on topic CB Auto Action ?
Thanks, it works perfectly.

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

10 years 3 months ago #247193 by pasquale1980
Replied by pasquale1980 on topic CB Auto Action ?
Hi, I would like to expose a my necessity and to understand if can do it with Community Builder and some of its components, I thought CB Auto Action. I have two types of users (eg student and professor). These, after the login on the site, through a list have the chance to see all registered users and their profiles (that is, students can see only the profile of professors and vice versa, but they can not see their own profiles (that is the student does not see the profiles of the other students, the same the professor). Newly registered users can view their profiles, but it contain only limited information (for example, the matter of the teacher and school). Would that, after the student has contacted the professor, for example with the exchange of a message (eg Uddeim) they can see their profiles in the full version (with more information, such as the school, matter, teacher's name, phone, e-mail, etc.). I thought to create two profiles (one with little information and one complete) and two groups for the same type of user, and manage them with access levels, meaning: if the contact between the parties has not happened, always displays the profile 1 (with limited information), if the contact has occurred, displays the profile 2 (full information).
But at login in the list should be displayed for all users, both, contact and non contact and of course the users not contacted can not see the complete profiles.
Thanks for any suggestions and help.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8283
  • Karma: 1443
10 years 3 months ago #247208 by krileon
Replied by krileon on topic CB Auto Action ?
You could use CB Privacy then set your tabs/fields to be moderator privacy controlled for Connections only. Then for the student to see the teachers profile the teacher would need to accept a connection request from the student as the various tabs and fields are only accessible to connections. To prevent students from seeing other students you could use a CB Auto Actions redirect action on the profile display trigger to try and send them away if the user is a student usergroup and the viewing user isn't the displayed profiles owner.


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.

10 years 2 months ago #247597 by pasquale1980
Replied by pasquale1980 on topic CB Auto Action ?
Is it possible with CB Auto Action during the registration process check if a textbox contains a word contained in a text area? Example: if the text field contains "Rome" and the textarea field contains "City of Rome", a warning message appears.
Thank you.

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

Moderators: beatnantkrileon
Powered by Kunena Forum