Skip to Content Skip to Menu

[SOLVED] Corona - Club App

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
4 years 5 months ago #319254 by krileon
Replied by krileon on topic Corona - Club App

The page Documentationxxx describes how I can insert values from an external table into the Comprofiler table.

It shows how to pull external data to display on profiles. It does not store this information. It simply displays it. The only way to store that information is to use something like a Query Select where that external information becomes a dropdown value or by using CB Auto Actions to push that fields value into the CB database.

Is there also an example of how I can write values in an external table and see them in the lists afterwards?

This is the complete opposite of what CB Query Field does. If you need to push data to an external database table you can easily do this using CB Auto Actions. Example as follows.

Global
Triggers: onAfterUserRegistration, onAfterNewUser, onAfterUserUpdate, onAfterUpdateUser
Type : Query
User: Automatic
Access: Everybody
Action
Query:
Code:
INSERT INTO `#__table` ( `user_id`, `content` ) VALUES( '[user_id]', '[FIELD_NAME]' )
Mode: External (configure the subsequent fields for connecting to your external database)

As for the triggers they're explained as follows.

onAfterUserRegistration = frontend registration
onAfterNewUser = backend registration
onAfterUserUpdate = frontend profile edit
onAfterUpdateUser = backend profile edit

If the database isn't an external database then leave Mode as Internal. You can use a Code action if you prefer to do this with custom PHP. If you don't need it acting on all those triggers remove whichever aren't relevant to your usecase. The above query would insert every time so it maybe best to ensure `user_id` is a unique index then use ON DUPLICATE KEY UPDATE behavior so it inserts or it updates.

Which I unfortunately noticed too late and have invested many hours.

Where did we give the impression CB is a CRM so we can further clarify what it is and is not. I apologize for the confusion.


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.

4 years 5 months ago #319271 by schrammelmann
Replied by schrammelmann on topic Corona - Club App

xgerry wrote: ... are really packed in only one single table. "Database normalization"
So there is no way to connect a second table to the profile. ...
... this also explains why my previous concerns came to nothing. ...


Your previous concerns led to nothing, because nobody understands what you want.
It seems like you are missing some basics, also with regard to databases. It makes me sad to see you wasting developers' time on immature questions.

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

  • xgerry
  • xgerry
  • OFFLINE
  • Posts: 32
  • Thanks: 1
  • Karma: 0
  • Add-ons
4 years 4 months ago - 4 years 4 months ago #319373 by xgerry
Replied by xgerry on topic Corona - Club App
Thank you for your help, it works as described.
Since it works, the question of whether the community builder is a CMS is even more difficult to answer.
After all, relations are possible.

Now I just have to sort correctly.
Sort by "counter" from the table "comprofiler_place_user"
How do I enter that? Do I need a new field?
Last edit: 4 years 4 months ago by xgerry.

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

  • beat
  • beat
  • ONLINE
  • Posts: 2169
  • Thanks: 463
  • Karma: 352
4 years 4 months ago - 4 years 4 months ago #319385 by beat
Replied by beat on topic Corona - Club App

xgerry wrote: Thank you for your help, it works as described.
Since it works, the question of whether the community builder is a CMS is even more difficult to answer.
After all, relations are possible.


Maybe the right answer is: Joomla is a CMS, but CB is not a CMS nor a CRM, but with CB Auto-Actions and other add-ons, and a bit of coding knowledge it has an enormous flexibility to do what you want (and that no CRM nor CMS will do by itself) ;)

Now I just have to sort correctly.
Sort by "counter" from the table "comprofiler_place_user"
How do I enter that? Do I need a new field?


Trying to answer with the very little information provided by the question:

As you are managing that table you would just need to add something like an " ORDER BY counter DESC" (or ASC) to your MySQL query to get the list into e.g. a CB Field, wherever it is.

We are here to help you, but we need your precise help to help you precisely and efficiently. Please read our " Help us help you " page, and provide us with details and context in your next questions. Obviously, we have no idea where your installation is and have no access to it nor can guess your settings nor what you wish to achieve. And don't want to have access. So please provide settings, screen-dumps, drawings, whatever needed to fully undestand context, with a precise question to get a precise reply.

The difficult art is to provide as little information as possible, but as much as needed. ;-)

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info
Last edit: 4 years 4 months ago by beat.

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

  • xgerry
  • xgerry
  • OFFLINE
  • Posts: 32
  • Thanks: 1
  • Karma: 0
  • Add-ons
4 years 4 months ago - 4 years 4 months ago #319396 by xgerry
Replied by xgerry on topic Corona - Club App
Under "list management" - "Sorting" - "Advance" I would like to indicate that it derives the sorting from the "Zaehler" database field.
Only "ORDER BY Zaehler ASC" does not work.
Do I have to make the detour via a CB field?

as I said: I have to address a field from another table.
Last edit: 4 years 4 months ago by xgerry.

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

  • beat
  • beat
  • ONLINE
  • Posts: 2169
  • Thanks: 463
  • Karma: 352
4 years 4 months ago #319402 by beat
Replied by beat on topic Corona - Club App

xgerry wrote: Under "list management" - "Sorting" - "Advance" I would like to indicate that it derives the sorting from the "Zaehler" database field.
Only "ORDER BY Zaehler ASC" does not work.
Do I have to make the detour via a CB field?

as I said: I have to address a field from another table.


Trying to guess: IF this is what you want to say: "There is a 'counter' field in a related table 'myCounts' where the 'id' column is the user id", then I guess again you want to have a Users-list SQL query that sorts with something like:

Code:
SELECT ue.*, u.*, '' AS 'NA' FROM `#__users` u INNER JOIN `#__comprofiler` AS ue ON ue.`id` = u.`id` WHERE u.`block` = 0 AND ue.`approved` = 1 AND ue.`confirmed` = 1 AND ue.`banned` = 0 AND ( SELECT COUNT(*) FROM `#__user_usergroup_map` AS g WHERE g.`user_id` = ue.`id` AND g.`group_id` IN (2) ) > 0 ORDER BY (SELECT mycounts.`counter` FROM #__mycounts_table AS mycounts WHERE mycounts.id = u.id) DESC LIMIT 0, 10

Then put in the Advanced Sorting of CB List Management something like:

Code:
(SELECT mycounts.`counter` FROM #__mycounts_table AS mycounts WHERE mycounts.id = u.id) DESC

If it's a different sorting and table, just adapt the SQL sub-statement of the ORDER BY advanced field.


In case: To debug your query and see page SQL queries, in Joomla Global Configuration, System Tab, activate Site Debug, then go to your users-list front-page and you will see Database Queries at bottom, when clicking on that accordion title.

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info
The following user(s) said Thank You: xgerry

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

Moderators: beatnantkrileon
Powered by Kunena Forum