Skip to Content Skip to Menu

[SOLVED] Associate Member With Another

  • bins
  • bins
  • OFFLINE
  • Posts: 465
  • Thanks: 40
  • Karma: 4
8 years 1 month ago - 7 years 4 months ago #285030 by bins
Our community has a number of regional member managers (who are also members) and I want to allocate each member one of these managers.

I thought of adding a field with a single selection from a drop down list, but think this is too basic and does not use the system to its best.

At the very least, I would like to allocate a manager to a member, for reporting.

Ideally, I would like to allocate the manager and have their details show in the members profile - 'here is your local contact'.

Is there an easy way to do this, or is it a case of dipping into some code.

I am about to create a user group to put these managers in (or re use an existing one!) if that helps.
Last edit: 7 years 4 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48438
  • Thanks: 8275
  • Karma: 1443
8 years 1 month ago #285047 by krileon
Replied by krileon on topic Associate Member With Another
Well you'll need a way to link the two users together. Whether it's a field or a new database table with both their user ids specified is up to you. Field is probably easiest. As for showing the managers contact information on the members profile you'll probably need to use CB Query Field or CB Code Field to either query for it or use PHP and getFields API to output it using the linked user id field or database table you've setup to determine who that information is coming from. CBs substitutions don't support substitutions within substitutions so that wouldn't work to just substitute in the user id. Maybe easier to just link to that managers profile.


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.

  • bins
  • bins
  • OFFLINE
  • Posts: 465
  • Thanks: 40
  • Karma: 4
8 years 1 month ago #285048 by bins
Replied by bins on topic Associate Member With Another
First the linking.

Can I create a field that allows me to easily choose who the manager is? I have been looking, but cannot work out if/how!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48438
  • Thanks: 8275
  • Karma: 1443
8 years 1 month ago #285053 by krileon
Replied by krileon on topic Associate Member With Another
Yes, CB Query Field and its Query Select fieldtype could be used. It builds the dropdown options from the results of a database query. If you're using a usergroup to determine if a user is a manager or not I'd just query _users then join the usergroup map table and filter it to those with your usergroup that way or have a CB field (checkbox for example) that you toggle to determine if they're a manager.


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.

  • bins
  • bins
  • OFFLINE
  • Posts: 465
  • Thanks: 40
  • Karma: 4
7 years 4 months ago #294583 by bins
Replied by bins on topic Associate Member With Another
Kyle,

I know this is an old post, but I never managed to get the query worked out. With my new found knowledge of CB Query Field I thought that I would give it another go, without success.

I have several members who are in a Joomla Group called 'Member Managers'. I would like to call this group up and select the relevant person, displaying their firstname & surname from comprofiler.

If I smile really nicely, do you think you could push me a little more in the right direction?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48438
  • Thanks: 8275
  • Karma: 1443
7 years 4 months ago #294588 by krileon
Replied by krileon on topic Associate Member With Another
You can use CBs userlists and Joomlas debug mode to help build queries like this. At the bottom of the page it exposes the queries and will show you how to do a simple join of the tables. Such example as follows.
Code:
SELECT u.`id` AS value, u.`name` AS label FROM `#__users` AS u JOIN `#__user_usergroup_map` AS g ON g.`user_id` = u.`id` WHERE g.`group_id` = USERGROUP_ID_HERE

That should give you a value and label for a Query Select usage. It'd store as their user id and display their full name. Supply the usergroup id to limit the selection to users with that specific usergroup.


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